Jump to content
Sign in to follow this  
Prefekt

RS232 Circuit

Recommended Posts

Hello,

I've a Transponder Board that implements a RS232 Interface. This Borad I can connect with my PC and I developed a software the can comunicate with the board.

 

Now i would like to get the information from the board with a pic. Need I a serial interface IC?

 

Has anybody a shematic and the C2C Code for a example application?

 

thanks

regards

Prefekt

Share this post


Link to post
Share on other sites

Prefekt:

As you know RS232 works with between +9/-9V and +12/-12 V for 0/1 levels, and TTL works with 0/5 V. If you want to comunicate a TTL device (a PIC or uC) with a RS232 device (like PC), you need an RS232 interface. If both are RS232 or TTL you don't need that interface. First of all you need to know which tipe of interfaces you want to interconect (a cheap digital tester or an oscilloscope are util for this porpouse), RS232 remains at "1" level when there is no data to transmit. Second you need to know if there is any kind of protocol for comunication or if you can implement the 8N1 standard (C2C uses 8N1).

There are too many circuits to implement an RS232 interface, MAX232 is the most common but it needs some external capacitors, MAX233 uses the same method. These pump capacitors are use as elevators, because MAX232 can't generate +12/-12V itself because it works with 5V. MAX203 had them implemented inside the chip, in this way the PCB is more simple. Both of them are full-duplex interfaces (you can send and receive sumultaniosly), there is a chip (DS275 or DS276) that is half-duplex (you only can send or receive at a time) it have only 8 pins and had the pump capacitors implemented inside the chip (is more expensive that MAX233 or MAX232).

The aplication note for them are in their Datasheets, on  the net you can find lots of PCB's for a RS232 interface. But you can do an RS232 Interface with a couple of transistors and resistors if you don't want to spend much money.

 

I think you need to do this:

 

PC<--->Board   convert to   Board<--->PIC

 

Look if there is a direct connect to a uC using a MAX, perhaps you can jump the RS232 conversion and connect the Board to the PIC adding some test points (soldering into the board). You can do that only if there is no interpreter between PC an uC.

 

If you can't jump RS232 conversion you have to do this:

 

Board<--->MAX232<--->PIC

 

I hope this info were util for your ...

 

Best Regards ... good luck ..

Joan

Share this post


Link to post
Share on other sites

@Joan:

Thank's, this was very helpful...

 

@All

Has anybody code for a serial connection? The examples on the example page dosn't work!

 

Thanks

Prefekt

Share this post


Link to post
Share on other sites

Prefekt:

the examples on the web works fine, but try with this code for PIC16F84A at 4MHz. It takes TTL Data converted from a PC->RS232 Interface:

 

#include

 

//RS232 settings

#pragma RS232_TXPORT PORTA

#pragma RS232_RXPORT PORTA

#pragma RS232_TXPIN  1

#pragma RS232_RXPIN  4

#pragma RS232_BAUD 9600

#pragma TRUE_RS232 1

 

//Timing settings

#pragma CLOCK_FREQ 4000000

 

main()

{

   char data;

 

   //Hardware Initialization

   disable_interrupt( GIE );

   set_bit( STATUS, RP0 );

   set_tris_a( 0x10 );

   set_tris_b( 0 );

   clear_bit( STATUS, RP0 );

   output_port_a( 0 );

   output_port_b( 0 );

 

   while(1)

{

dato=getchar();

PORTB=data;

}

}

 

Regards;

Joan B)

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...