Hi everyone im new to this hobby and these forums
Im having trouble communicating between my serial port and a pic16f690 using a max232. I have searched all over the web but for some reason I just cannot find anything helpful to me.
I have gone over the hardware multiple times and I have all 5 caps connected correctly to the max232, I have put together a basic program from searching Google that just sends back what it receives but it does not send back the correct characters. For example if I send a "d" it returns an "ä", if I send an "H" it returns an "È" etc. I have also noticed that it returns the same character (although it's wrong) 90% of the time now and then it returns a different character all together.
Now I understand that using the internal clock is not a good idea with serial communication, which to me seems like the reason it sends back a different character 10% of the time, but surely it shouldnt always be wrong - must be my code:
Code:
Include "modedefs.bas"
DEFINE OSC 3
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 92
DEFINE HSER_CLROERR 1
cm1con0 = 0
cm2con0 = 0
ansel = 0
anselh = 0
Char VAR BYTE
led var portb.6
output led
input portb.5
output portb.7
led=1
pause 500
led=0
pause 500
led=1
pause 500
led=0
pause 500
Main
HSERIN [Char]
led = 1
HSEROUT [Char]
pause 10
led = 0
GOTO Main
END
As I said this is a very new hobby but I am trying to learn here
I am using microcode studio and picbasic pro with a pickit 2 starter kit if that helps.
Thanks for any help,
Ross.
Bookmarks