Quote Originally Posted by lerameur
I have two Pic16F88 ( did try a PIC16F628A once to see what would happen, how did you know, I dont think I mentioned that)

both circuits are running independently, Just the power supply is hooked up in parallel. Two circuits, two breadboards. two are doing the same thing


k
Ok, I'm back. I don't think you did specifically mention you had a 16F628A except that it was in one of the headers of one of your files somewhere.

So, you've got 2 16F88's, one will eventually be a transmitter (TXPIC), one will eventually be a receiver (RXPIC).

Right now, both PICs right now have 4 LEDS and a push button. When you fire it up, the leds do their little power up check, then when you push the button, the leds light up in sequence about once per second.

Release the button, the sequence stops until you hit the button again right?

If that's correct, now we'll connect the 2 PICs, define one as TXPIC and and as RXPIC.
On the TXPIC side:
Select a pin for serial output. I suggest RB2.

-------------------------------------
Add:
txout var portb.2
output txout
dataout var byte

near the beginning of your TXPIC program, next to the rest of the variable declarations
--------------------------------------

-------------------------------------
And add:
dataout = ledcount
serout txout, n2400, [ dataout ]
pause 100

on the line after 'ledcount = ledcount + 1', but before the 1st endif
---------------------------------------




On the RXPIC side:
Select a pin for serial input. I suggest RB5.

-------------------------------------
Add:
rxin var portb.5
input rxin
datain var byte

near the beginning of your RXPIC program, next to the rest of the variable declarations
--------------------------------------


------------------------------------
Change your RXPIC code to this (starting at mainloop):

mainloop:
serin rxin, n2400, 5000, nodatarx, datain
'if no data received in 5 seconds, jump to nodatarx

if datain = 0 then 'all leds off
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
endif

if datain = 1 then '1st led on
led1 = 1 : led2 = 0 : led3 = 0 : led4 = 0
endif

if datain = 2 then '2nd led on and so on and so on down the line....
led1 = 0 : led2 = 1 : led3 = 0 : led4 = 0
endif

if datain = 3 then
led1 = 0 : led2 = 0 : led3 = 1 : led4 = 0
endif

if datain = 4 then
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 1
endif

goto mainloop

nodatarx: 'flash the leds 3 times
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
led1 = 1 : led2 = 1 : led3 = 1 : led4 = 1
pause 400
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
pause 400
led1 = 1 : led2 = 1 : led3 = 1 : led4 = 1
pause 400
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
pause 400
led1 = 1 : led2 = 1 : led3 = 1 : led4 = 1
pause 400
led1 = 0 : led2 = 0 : led3 = 0 : led4 = 0
goto mainloop

END
----------------------------------------



Connect the PortB.2 pin on the TXPIC to the PortB.5 pin on the RXPIC, and write/burn the programs.
This should make the TXPIC and RXPIC act in their respective roles. You push a button on the TXPIC, it sends a code to the RXPIC. Both sets of LEDs on both PICs should match. If you don't send a code for 5 seconds the RXPIC will flash the LEDs 3 times, then turn them all off. The next time you press the button on the TXPIC, the same leds should be on for both the TXPIC and RXPIC.

Try it out, see what happens....
JDG