Sorry for all those continuous questions but its really frustrating! I used a PIC16f to communicate via rs232 to my pc! Everything worked ok!
I now replaced the pic with a PIC18f2680 and I get nothing on the screen of my PC when sending a "Hello". Something is received but I think it is a problem with the communication protocols. Does anyone know how I need to set the HSER_BAUDCON register for 2400pbs communication?
I though I could only set the brg16 to zero but nothing... Here is my code which worked (without the define hser_baudcon) with a pic16f.
DEFINE HSER_RCSTA 90h 'Enable Serial PORT
'8 bit reception
'Disable Single receive
'Enable continuous receive
'All bytes received, diable address detection
'No framming Error
'No overrun error
DEFINE HSER_TXSTA 20h '8 bit transmission
'Enable transmit
'Asyncronous mode
'Low baud rate (BRGH=0)
'TSR full
define HSER_BAUDCON 0h
DEFINE HSER_SPBRG 64 'set USART to 2400 baud (when BRGH=0)
define hser_cloeer 1
'Oscillation Settings
'---------------------
DEFINE OSC 10
loop:
hserout ["Hello",13]
pause 100
goto loop
=====================
Same code doesn't work with 18f2680.
According to PIC18f2680 datasheet when Sync=0, BRGH=0 and BRG16=0 for 2400bps you set SPBRG = 64 at 10MHz...Could it be that some of the BAUDCON bits other than BRG16 shouldn't be 0??
Bookmarks