Hi all,

First post here, hopefully one of many (helping as well as getting help)

I have a question that I'm sure has a very simple answer, but I'm having trouble with it. I've got a situation where I need to use multiple PICs in a project (I'm working with the PIC16F628A on a 4MHz XTAL) and I need them to be able to send data to one another. One will only send data and one will only receive data. Nothing fancy, it only needs to send a single digit number.

What I'd like to know is, what is some basic code to put on PIC A and PIC B to get PIC A to send numbers 0 to 3 via SEROUT and have PIC B recognise those numbers and, say, light up an appropriate LED. Currently I'm using the following code:

'PIC A (Sender)
INCLUDE "modedefs.bas"

x VAR byte

main:
FOR x = 0 to 3
SEROUT PORTB.0, T2400, [x]
PAUSE 1000
NEXT
GOTO main


'PIC B (receiver)
INCLUDE "modedefs.bas"

x VAR byte

main:
SERIN PORTB.0, T2400, [x]
IF x = 0 THEN HIGH PORTB.1
IF x = 1 THEN HIGH PORTB.2
IF x = 2 THEN HIGH PORTB.3
IF x = 3 THEN HIGH PORTB.4
GOTO main


I'm aware it may also be a wiring issue... I just have a straight wire (I'm breadboarding this first) going from PORTB.0 on PIC A to PORTB.0 on PIC B.

Anyone have some advice?

Thanks in advance!