Hi,
I'm just trying the communication between two PICs (both 12F675) using Serin and Serout with the codes written below:
For the transmitter:
Code:
Include "modedefs.bas" ' Include serial modes
define osc 4
output GPIO.1
SO var GPIO.1 ' Define serial out pin
B0 Var byte
B0=50
pause 3000
mainloop:
Serout SO,N9600,[B0] ' Send character
Goto mainloop ' Forever
End
And for the receiver:
Code:
Include "modedefs.bas" ' Include serial modes
define osc 4
input GPIO.1
SI var GPIO.1 ' Define serial in pin
B0 Var byte
output GPIO.2
LED VAR GPIO.2
main:
LED=0
pause 1000
LED=1
pause 1000
LED=0
mainloop:
Serin SI,N9600,[B0] ' Receive character
if B0=50 then LED=1
Goto mainloop ' Forever
End
I connected GPIO.1 pins of the transmitter and receiver PICs to each other. When I check the voltage on the GPIO.1 pin of the transmitter PIC it shows around 2.95V after 3 seconds since the program started which I interpret as the PIC is sending some data. However, the receiver PIC is supposed to turn the LED on if it gets a byte with the value 50 but nothing happens. Could you help me please?
Thanks in advance.
Bookmarks