I have two PIC16F628A's and I am trying to get them to communicate serially with each other. When a button is pressed, the LED on the receiving PIC should go on (similarily, when it is released the LED with go off). Unfortunately this is not working. I am wondering if the breadboard is somehow interfering with the packets...my code is below.
Any help is appreciated!
-Mike
transmitter
---------------------
' Set transmit register to transmitter enabled
DEFINE HSER_TXSTA 20h
' Set baud rate
DEFINE HSER_BAUD 2400
cmcon = 7
Main:
If (PORTA.1 = 0) then
hserout ["1"]
endif
if (PORTA.1 = 1) then
hserout ["2"]
endif
goto main
end
-----------------------
Receiver
------------------------
define HSER_CLROERR 1
define HSER_RCSTA 90h
define HSER_BAUD 2400
Msg Var BYte
cmcon = 7
Main:
hserin [Msg]
if (Msg == "1") then
high PORTA.1
endif
IF (Msg == "2") then
low PORTA.1
endif
goto main
Bookmarks