CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Design ideas for testing RS 232 communications unit w/o PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

Design ideas for testing RS 232 communications unit w/o PIC
PostPosted: Sun Jun 11, 2006 7:10 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Mon Jun 12, 2006 8:00 am     Reply with quote

..

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

View user's profile Send private message

PostPosted: Mon Jun 12, 2006 11:32 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group