View previous topic :: View next topic |
Author |
Message |
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
Design ideas for testing RS 232 communications unit w/o PIC |
Posted: Sun Jun 11, 2006 7:10 am |
|
|
Hi,
I am developing a controller for an alignment system, this controller uses a RS232 communication module that has two opto-couplers for TXD and the RXD lines.. These are used for communication between the PIC and the PC.
I want to develop a method a method/unit for testing this communication module.. the system must diagnose even if the PIC is defective..
I considered some ideas like looping back ASCII characters from RXD to the TXD.
The unit starts up with the loop back enabled, to test the link I send a code on TXD and receive it on RXD,. To disconnect the loopback (assuming the PIC is OK) , I send a code to the PIC from the PC this disconnects the loopback so now only the PIC gets the data, I do not know how I can enable/disable the loopback..maybe use a relay (!)
Please advise ???
thanks
arunb |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Jun 12, 2006 8:00 am |
|
|
..
Last edited by treitmey on Mon Jun 12, 2006 12:33 pm; edited 1 time in total |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Jun 12, 2006 11:32 am |
|
|
Quote: |
I want to develop a method a method/unit for testing this communication module.
|
You can do it with a relay. I would use a relay because it can be easily inserted in the RS232 line. Using a FETs in this scenario will be a pain in the neck.
At power up, energize a relay to connect Tx to Rx (in the RS232 side) while running a simple test. Remember that when you switch the RS232 lines you must keep only one circuit active, you can't share an RS232 line, at least the Tx line.
Code: |
tx_char = 'A';
loop = 30;
do
{
putc(tx_char);
rx_char = getc();
loop-=1;
if( rx_char == tx_char)
tx_char = rx_char + 1;
else
error+=1;
}while((tx_char != 'Z') && (loop));
|
Then you must examine the variables involved in the loop to know the result.
This is a trivial test that you can improve according to your application.
Quote: |
the system must diagnose even if the PIC is defective..
|
Well, to get this feature I can�t imagine how to do it with a single PIC, lets wait for a good idea from the folks.
Humberto |
|
|
|