View previous topic :: View next topic |
Author |
Message |
volki_56
Joined: 21 Apr 2008 Posts: 3
|
interesting rs 232 problem!!! F1 please :) |
Posted: Sun Apr 27, 2008 5:35 am |
|
|
Hi to everybody..
I have a project about rf communication. (Rf integrates are UDEA atx-34 UDEA arx-34) I should communicate 2 pic 16f628 with each other. The communication will be full dublex. But i wanted to try it step by step. So first i communicated them half duplex. First circuit has transmitter and the second circuit has receiver, and the rf integrates communicates with PIC by the UART module. As you know i used for receiver for half dublex.
Code: | #use rs232(BAUD=600, RCV=PIN_B1 ) |
and for transmitter
Code: | #use rs232(BAUD=600,XMIT=PIN_B2) |
the system works with these parameters perfect.
But when i try to communicate them full dublex with the code ;
Code: | #use rs232(BAUD=600,XMIT=PIN_B2, RCV=PIN_B1, BRGH1OK, PARITY=N, BITS=8,ERRORS) |
it doesn't work !!!
i couldn't understand? what can be problem??
this is my final project and i have only a mount to achieve it...thanks |
|
|
Izzy
Joined: 27 May 2007 Posts: 106
|
|
Posted: Sun Apr 27, 2008 7:17 am |
|
|
Try using hardware UART. Pin C6 and C7.
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
and make sure you have C6 of one PIC connected to C7 of another PIC and vice versa. |
|
|
volki_56
Joined: 21 Apr 2008 Posts: 3
|
|
Posted: Sun Apr 27, 2008 2:24 pm |
|
|
Sorry but i wrote PIC 16f628...it has no c port..Maybe you confused with 16f877...i used the uart module of 16f628..
It is very interesting and nonsense...
Has anybody ever experienced this problem??? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Apr 27, 2008 3:10 pm |
|
|
Are you using interrupts for the communication?
Half duplex is easy without the use of interrupts but for full-duplex you need interrupts or you are running a high risk of loosing data.
You will have to show more of your program for us to tell what is wrong. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sun Apr 27, 2008 4:44 pm |
|
|
Quote: |
But when i try to communicate them full dublex with the code ;
Code:
#use rs232(BAUD=600,XMIT=PIN_B2, RCV=PIN_B1, BRGH1OK, PARITY=N, BITS=8,ERRORS)
it doesn't work !!!
i couldn't understand? what can be problem??
|
Well, to communicate both devices in full duplex mode, the above modifications are not
the only things that you need to do. You need to establish a way to handle or arbitrate the
data flow between devices, normally it is done either using Hardware Control (RTS/CTS) or
Software Control (Xon/Xoff). The only chance that you have in an RF link, is to use Xon/Xoff.
Software Control Xon/Xoff
When the buffer within the receiving end is nearly full, Xoff is sent to the transmitting end
to ask it to stop when data have been processed by the receiving end and the buffer has
space again, Xon is sent to the transmitting end to notify it to resume.
Hardware Control (RTS/CTS)
The transmitting end activates RTS to inform the receiving end that it has data to
send if the receiving end is ready to receive, it activates CTS.
Humberto |
|
|
|