PDA

View Full Version : Serin2/ Serout2



Armadus
- 23rd June 2008, 20:29
I am trying to send data between two PIC 18F242s.
I use the command:
Junk Con 198: Synch Con "A": Dat var byte: INCLUDE "mosdedefs.bas"

Dat = 15
Serout2, PortC.5, 84, [Junk, (Synch), Dat] to send data to the second PIC.

I receive the data with the command: Serin2, PortC.4, 84, [Wait (Synch), Dat]

I receive the data correctly. I then try to send a signal back (using the same commands reversed) from the second Pic to the 1st, and the data is not received.

I can switch the PICs and it will work from the 2nd to the 1st, but will not the 2nd PIC will not receive the data after sending.

I have used this program for some time, but it now does not work.

skimask
- 23rd June 2008, 21:05
Are you trying to use an RF module in between the two PICs or just hardwared them together?


junk Con 198: Synch Con "A": Dat var byte: INCLUDE "mosdedefs.bas"
Put the include on it's own line.


I receive the data correctly. I then try to send a signal back (using the same commands reversed) from the second Pic to the 1st, and the data is not received.
It's probably not ready for it, or it's been ready and has given up already.

Armadus
- 24th June 2008, 00:06
My final use is with radios, but I am now trying direct wires.

I have experimented with time delays to make sure the receiver is ready, but it appears to lock up when trying to send the return command.

Thanks

falingtrea
- 24th June 2008, 23:01
Are you sending the data bidirectionally across the same wire? Or are you sending on C.5 and receiving on C.4 on both parts, using two wires?

Armadus
- 25th June 2008, 00:02
I am sending and receiving on the two ports on each PIC with two wires.

Not sure why, but the problem was solved when I reset each Port to Input after transmitting or receiving.