Hi Larry, It's an adventure doing it without interrupt. I totally would not recommend this. Yes. That's true. RF modules usually need sometime to "power-up" or "lock-on" to the data first before actually receiving the data correctly. I think it's a pain to have to send some data (preamble or something like that) first to activate those RF modules, and then, send the data. Not to mention if your data has a lot of simultaneous '1' (try sending 0xff, the RF modules will really mess this one up). That's why I built my own RF "interfacer" chips. These chips take care of that for me. They maintain the RF transmitter and receiver active ALL the time. They make the RF transmission transparent, so that RF connection will behave almost like a straight wire connection. I can send a 0xff continuously (I have tried it), and it gets it everytime. Here is some code to help you with interrupt: ; Note that in the code, I also enabled serial Tx. If you don't need this, just get rid of it ;-- variables in memory --; rx_byte equ 0x20 w_temp equ 0x70 status_temp equ 0x71 ORG 0x000 goto main ORG 0x004 movwf w_temp ; save off current W register contents movf STATUS,w ; move status register into W register movwf status_temp ; save off contents of STATUS register ;-- ISR code here --; ; note: - I am assuming that NO OTHER interrupts are enabled but the serial RX ; - I don't try to take care of the errors, except re-enabling the serial RX btfsc RCSTA, FERR ; does frame error occur? goto Rx_error btfsc RCSTA, OERR ; any overrun error? goto Rx_error ; everything looks good, now read data & do what you want with it movf RCREG, w movwf rx_byte ;---- do whatever you want with the data here ---; goto end_of_ISR Rx_error movf RCREG, w ; read the data anyway (MUST be done) bcf RCSTA, CREN ; re-ENable RX, this clears FERR & OERR error flags as well bsf RCSTA, CREN ;-- end of ISR code --; end_of_ISR movf status_temp,w ; retrieve copy of STATUS register movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt ;------------------------; ;-- start of main code --; ;------------------------; main clrf PORTB bsf STATUS, RP0 ; select bank 1 movlw b'00000010' ; RB1 inputs, others outputs movwf TRISB ; setting 1200 N 8 1 ; 1200bps, no parity, 8 data bit, 1 stop bit bcf TXSTA, SYNC ; set asynchronous bcf TXSTA, BRGH ; set low baud rate movlw 0x33 ; 1200bps (51 = 0x33 @ 4MHz) movwf SPBRG bcf STATUS, RP0 ; select bank 0 bsf RCSTA, SPEN ; ENable Serial Port bsf STATUS, RP0 ; select bank 1 bsf TXSTA, TXEN ; ENable TX bsf PIE1, RCIE ; Enable RX interrupt bcf STATUS, RP0 ; back to bank 0 bsf RCSTA, CREN ; ENable RX ; Serial Port all set, now transmit through RB2 by loading TXREG (0x19) ; When data is ready to be sent again, TXIF/PIR1<4> (0x0c) is '1' ; receive through RB1. RCIF will be set when reception is complete. ; Interrupt will be generated. Read RCSTA (0x18) to determine any errors ; Read RCREG (0x1a) for the data received bsf INTCON, GIE ; Enable Global Interrupt bsf INTCON, PEIE ; Enable Peripheral Interrupt main_loop nop nop goto main_loop -----Original Message----- From: Larry Kayser [mailto:kayser@sympatico.ca] Sent: Thursday, January 24, 2002 11:21 AM To: "Rudy Rudy" Subject: [PIC]: USART on 16F628 Rudy: > What I am trying to do is to get serial communication > through RF from my laptop to a 16F628 I would sure like to have a peek at your code for this, I am fighting doing it without Interrupts and maybe I am leaving something out... > So, after that I tried it through RF. I do not have explicit experience here, but I can tell you that most RF linking things work better if you key the RF on and let it settle a while. say 200 to 300 Milliseconds or more before you let the DATA burst go. I am using some of the 900 MHz modules here and I have to give them settling time. I am working over a 6 mile path with a 10W amp on the 900 MHz module, ex Cellular amplifier, and they work fine but you have to give them time to settle one they are turned on. I also put in some SYNC characters in front of the message so that the demodulator has a chance to get started properly as well. Larry VA3LK -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics