Help with pic16f690 -max232cpe
So i started to try out some serial com and after alot of struggling i have gotten it almoste to work.
i have pickit2 with pic16f690 and a demoboard with max232.
max232:
pin 1 & 3 - 1uf
pin 4 & 5 - 1uf
pin 2 - 1uf to vdd
pin 15 - 1uf to gnd
and gnd to vdd 1uf
so i have been able to recive text on my computer from the pic but it's somehow malformed.
i try to send "Hello World", 13, 10
and i get
Hello0World<(8A)>
when i stop the pic i recive the space and cr and lf
when i make the pic hserout the hserin i returns random alphas or signs.
my current code is as follows:
Code:
DEFINE OSC 4
'intcon=0 ' Interrupts disabled
cm1con0=0 ' Comparator 1 disabled
cm2con0=0 ' Comparator 2 disabled
'cm2con1=0 ' Comparator 2 disabled
ANSEL=0 ' Pins to be Digital
ANSELH=0 ' Pins to be Digital
Include "modedefs.bas"
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h 'sets bergh = 1 or 20h sets = 0
DEFINE HSER_BAUDCON 0h ' 0h
DEFINE HSER_BAUD 9600 '16468
DEFINE HSER_SPBRG 25
'DEFINE HSER_CLROERR 1
main:
hserout ["Hello World", 13, 10]
pause 1000
goto main
and i cant figure out why!
im using picbasic with MC studio and MPASM
Please HELP
Got it working but not proud
Okey so finally i got this working, but the story about how i did it is kinda BAD.
So after a while i was beginning to wonder why it was reading wrong voltages. and i knew the connections where right, until i look really close to the serial cabel, i used a rs232 to rj45 and a cat5 cabel, but i somehow got the colors mixed up. So ground was not connected.:o heh.... well u think stupid you, and yes stupid me. not going to that mistake again. So then i started to check the connection on my breadboard and pow it splits in the middel where i had put my pic. so basicly i had half of the earth connections not connected. And i connected it this way after it was connected the right way. but then i did not have the pin 5 from rs232.
Maybe it's a lesson to learn from all of this. ALWAYS check ur cabel and make sure pin5 is connected.
BTW how many times have i answerd What colour is a ripe tomato?
lost count:)
Sorry to have wasted everybodies time but i really appricihate it.
And i did learn alot from searching and reading around the net.
Thx for all the help once again and sorry that im such an idiot