ruijc
- 2nd December 2007, 20:53
Hi all,
I have here a 12F675 and i was using it read a LM35 and send out temp to PC via serial port ( not using MAX232 ).
The problem is that i'm facing comunication problems.
I cant get the pic to send a correct word out !
All i get is rubbish.
I've seen someone here with the same problem but it was resolved with XT->HS change !
I've tryed so many things ( speed, xtals, etc ) and nothing works :(
Here's the code:
@ DEVICE PIC12F675, MCLR_ON
' Master Clear Options (Internal)
@ DEVICE PIC12F675, PROTECT_OFF
' Program Code Protection
define osc 4
Include "modedefs.bas" ' Include serial modes
define osc 4
ANSEL = %00000000 ' Set analog ports to digital mode
CMCON = %00000111 ' Turn off comparator
'TRISIO = 00001000 ' designate gpio.0,1,2,4,5 as output 3 as input
WPU = %00000000 ' Disable pull-ups
TRISIO = %00000 ' Set all I/O's to outputs
out:
low gpio.2
Serout2 GPIO.1,396,["396",10,13] ' check if this works
pause 200
Serout2 GPIO.1,84,["84",10,13] ' or this
pause 200
Serout2 GPIO.1,188,["188",10,13] ' or this
pause 200
Serout2 GPIO.1,16572,["16572",10,13] ' or this
pause 200
Serout2 GPIO.1,N2400,["N2400",10,13] ' or this
pause 200
high gpio.2
pause 500
Goto out
thanks for the help
.
I have here a 12F675 and i was using it read a LM35 and send out temp to PC via serial port ( not using MAX232 ).
The problem is that i'm facing comunication problems.
I cant get the pic to send a correct word out !
All i get is rubbish.
I've seen someone here with the same problem but it was resolved with XT->HS change !
I've tryed so many things ( speed, xtals, etc ) and nothing works :(
Here's the code:
@ DEVICE PIC12F675, MCLR_ON
' Master Clear Options (Internal)
@ DEVICE PIC12F675, PROTECT_OFF
' Program Code Protection
define osc 4
Include "modedefs.bas" ' Include serial modes
define osc 4
ANSEL = %00000000 ' Set analog ports to digital mode
CMCON = %00000111 ' Turn off comparator
'TRISIO = 00001000 ' designate gpio.0,1,2,4,5 as output 3 as input
WPU = %00000000 ' Disable pull-ups
TRISIO = %00000 ' Set all I/O's to outputs
out:
low gpio.2
Serout2 GPIO.1,396,["396",10,13] ' check if this works
pause 200
Serout2 GPIO.1,84,["84",10,13] ' or this
pause 200
Serout2 GPIO.1,188,["188",10,13] ' or this
pause 200
Serout2 GPIO.1,16572,["16572",10,13] ' or this
pause 200
Serout2 GPIO.1,N2400,["N2400",10,13] ' or this
pause 200
high gpio.2
pause 500
Goto out
thanks for the help
.