When i use a 18F4550 to communicate with the pc it will not work right.
The interface between pic and PC is oke (RS232), because when i use a 16F876 with the same code it works fine.
I've gone over the datasheet over and over and i think that is setup everything right.
but just a simple character transfer does not even work.
who can help me or has faced the same problem??
p.s. USB etc works great, but now i also need Usart!!
Here is the simple code that will not work.
send char "A" to the PC
at 2400 baud, no data received, at lower or higher speed "crap" is received.
' simple usart test pic18f4550
define osc 20
trisc.7=1 'portc.7 input RX
trisc.6=0 'portc.6 output TX
baudcon.3=0'BRG16 :0=8 bit baud generator
txsta.2=0 'BRGH 0=low speed
SPBRG=129 '2400 baud see datasheet
txsta.4=0 'SYNC 0=asynchoon
rcsta.7=1 'SPEN serial port enable
txsta.6=0 'TX-9 :8 bit data
txsta.5=1 'TXEN transmit enable
ADCON1=15 'all ports digital i/o
start:
Hserout [$41] 'send char A at 2400 baud
pause 2000
goto start
what i'm i doing wrong ???????????
Bookmarks