Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC to PC serial problem....

Not open for further replies.


Member level 1
May 14, 2009
Reaction score
Trophy points
Activity points
pic to pc


Im trying to network a multidrop RS-485 network. Please see the enclosed diagram of how i have made the wiring arrangement.

- Board A represents the PC with RS-232 to RS-485 convertor

- Board B represents PIC board 1 with MAX488 line driver

- Board C represents PIC board 2 with MAX488 line driver

Both PIC boards B and C are the same using PIC18F4220 with 4MHz crystal.

Now i can get one way communication (from PC to PICs only) and my string of characters are successfully received by the PICs. The data is sent from the PC in packets and each packet is uniquely addressed to each PIC board.

Now when I attempt to do the reverse, that is send a reply back from PIC board C....& not simultaneously with board B, the packet successfully reachs the PC. However now when the same is attempted with PIC board B only, again making sure not simultaneously with PIC board C, then the packet never reaches the PC.

It appears only PIC board C is able to send packets to the PC.

Im also making each TX pin on the PIC an input pin when NOT transmitting. I only make it output direction, when Im getting ready to transmit.

As a simple test program, Im only sending out a packet when I press a button on the PIC boards (B or C). Therefore im in control of when a packet should be transmitted. Therefore, i can not understand this puzzle of why the packet failure from PIC board B.

Please can someone help me to achieve sending packets successfully from both PIC boards (B and C) back to the PC (each board taking turns in TXing and NOT simultaneously TXing)....using the same wiring connection is shown in my diagram. If there needs to be any change made, then please also let me know.

Thank you


pic to pc communication

It looks like board C is permanently driving the bus.

You have to make sure that the drivers are only enabled while you are transmitting then disabled afterward. Unfortunately, if B and C drive simultaneously, you will get garbage out so you need to implement a protection system in software to cater for such bus collisions.


pic to pc serial

hello Brian

thats exactly what im doing...

Im using C18 compiler so i dissable the TX pin when NOT transmitting by making it an input pin ... i use this code statement.

TRISCbits.TRISC6 = 1; //make TX pin input

and then when i wish to transmit....i make it output by this statement...

TRISCbits.TRISC6 = 0; //make TX pin output

of course the pins are reverted back their previous state as soon as the packet is sent.

so now with this information...can u analyze and help me?

thank you


com serial pic pc

It sounds like you are disabling the wrong pin. By changing the TRIS bits you can drive or read the PIC pins but the problems is with the RS485 driver. Even with the PIC set to input mode (TRIS = 1) the driver IC is still feeding your bus.

I think you have to drive the RS485 transceiver enable to control whether it is attached or isolated from the bus. You may have to allocate another PIC pin to connect to the driver disable pin. You should be safe to leave the receiver permanently enabled but if more than one transmitter activates you will get bus contention.


Just checked the data sheet - drive DE high to transmit and low when not transmitting.

pic board c

thank you so much brian...

i will try ur suggestion. i will now have to use MAX483 instead in order to use the DE and RE pins. im sure my project will now work.

thank you


rs485 line pic

simple introduction of rs-485 protocols,
**broken link removed**


RS232 to RS485 converter related information on this page.
**broken link removed**

Expansion of Input and Output (I/O) Lines of a micro-controller and method of communications, please have look on this.
**broken link removed**

Not open for further replies.

Part and Inventory Search

Welcome to