-
Serin2/Serout2 PIC 2 PIC
I am trying to communicate between 2 PICs for a week now. But have no success still.
I am using the PIC16F877A as the transmitter and PIC16F628 as the receiver.
All I am trying to do is take some data say decimals and send it to the 628 where it should disply it on a LCD.
Here is what I was trying so far.
'TX
Include "modedefs.bas"
Temp1 VAR BYTE
Temp2 VAR BYTE
Temp1 = 1
Temp 2= 5
loop: High PORTC.1 'LED indicator for transmission
Serout2 PORTC.6,N2400,["A",temp1,temp2]
Pause 200
Goto loop
"RX
include "modedefs.bas"
Temp1 VAR BYTE
Temp2 VAR BYTE
loop: Serin2 PORTB.1,N2400,[wait("A"),Temp1,Temp2]
Pause 200
LCDout $fe,1
LCDout DEC Temp1, DEC Temp2
Goto loop
Doesn't this just send the the numbers 1 and 5 to the LCD?
I am running the PICs with 10MHz xtal. I have tried it with 4MHz and still nothing. I tried DEFINE OSC 10.
I have just a wire linking PORTC.6 of the 877A to the PORTB.1 of the 628.
Hopefullly someone has tried thi before.
HELPPPPPPP!
Thanks
Randy
-
A exremely good friend of mine as accomplished this using a
12f675, and a 16f648.
The 12F675 is the transmitter, and the 16F648 is the receiver.
We developed our own little "Protocal", and send the data to the 16f648, allowing the 648 to display on our LCD, because it has the 8 bit port to power the LCD.
I would be curious if you get yours working, using the built in Serial commands...
Dwayne
-
Tx
loop:
serout2 portc.6,813,["A",byte1, byte0]
pause 100
goto loop
Rx
serin2 portb.1,813,[wait ("A"),byte1, byte0]
This works for us. It's slow but it works fine for us. All you should have to do is check the 813 to something faster.
-
You can't use N2400 with Serin2 or Serout2.
Check this list of modes.
http://www.melabs.com/resources/ser2modes.htm
The equivelent of N2400 is 16780