Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

serial data communication debugging

Status
Not open for further replies.

ashraf

New Member
I am using two number of PIC18f452 microcontrollers.

TX1 pin of first PIC18f452 connect with RX2 pin of second PIC18f452
&
RX1 pin of first PIC18f452 connect with TX2 pin of second PIC18f452

Now i want to see this two way communication over my PC through serial port without any intruption.

Is it possible?
What circuit will be required to make it possible
 
What kind of data are you sending? Is it just ASCII text? For the serial port, you will need an RS-232 transceiver,
**broken link removed**
unless the PIC µC has them inside. I doubt it, but I'm not an expert on PICs. For plain ASCII text you could view the data using Hyper Terminal. Is this just for monitoring purposes, or will the PC be playing a more active role?
 
Yes i am using max232 IC for PC .
I want to TX and RX from PC as wel when ever i need to send and receiver data.
Yes its a simple ASCII text and i want to see it on hyper terminal
 
I think that so far that the responders of this posting have failed to understand the complexity of what the OP is wishing to do.

"Now i want to see this two way communication over my PC through serial port without any intruption."

He wants to be able to monitor (and send to?) TWO serial data links using ONE PC comm port. That is the two PICs are sending and receiving to each other and he also wishes to be able to monitor and send into these two links with his PC.

That can't be done without some kind of external ORing logic circuity. Using TWO PC comm ports with two instances of hyper terminal loaded could solve for the PC monitoring both links (receiving) part, but there would still be external ORing logic needed for the PC to be able to send to either PIC, again as the two PICs are also wired to each other.

While one can wire a single output terminal to more then one input terminal, one can't just wire two output signals together to a single input terminal, they will not play well together.

Am I missing something?

Lefty
 
Last edited:
I see. After re-reading his post, I agree. Two instances of Hyper Terminal would be the way to go. It would probably be easier to just use Com1 and Com2, if available. I think it could be done by outputting both TX lines and inputting both RX lines to the PICs. This would be the obvious hardware solution. Controlling it through software would be more difficult. Perhaps an external trigger or maybe something as simple as a switch to "halt" communications between the PIC when Hyper Terminal is used to send data. Does this sound logical?
 
If it can be done with some kind of external Oring circuitry, then i would like to know your idea in detail with a logic circuit diagram.

keep the following things in your mind while making logic circuit diagram

1. I want to monitor both PIC TX1 and PIC TX2 on my PC via RS232 without any switching.

2. & want to send data from my hyper terminal via RS232 to my PIC RX1 & PIC RX2 without any switching
 
If it can be done with some kind of external Oring circuitry, then i would like to know your idea in detail with a logic circuit diagram.

keep the following things in your mind while making logic circuit diagram

1. I want to monitor both PIC TX1 and PIC TX2 on my PC via RS232 without any switching.

2. & want to send data from my hyper terminal via RS232 to my PIC RX1 & PIC RX2 without any switching

By switching, do you mean mechanical or software? Your talking about three-way communcication. In my opinion, you would need a way to halt the traffic on you PIC bus so Hyper Terminal could gain access.
To monitor your TX lines is no big deal. Use Com1/2 with two instances of HyperTerminal running on your desktop.
How will the flow of traffic work in your system with two PICs talking to each other and you making changes on the fly? What do you envision?
 
RS232 is point to point (Two devices), plus your PC's RS232 port is too high a voltage for the TTL level serial ports on the 18F452.
RS485 is more practical for multipoint serial communications.
 
Switching is not required either mechanically or programitacally.
& only ONE com port is available with my PC.
If two transmit line can monitor on two seperate COM ports then how to send data from PC to two PIC receive lines from PC.
As we know one transmit and many receive can be possible
but many tranmit and one receive can not be possible without having some sort of circuitry.

And i am asking for the same kind of circuitry.
 
RS232 is point to point (Two devices), plus your PC's RS232 port is too high a voltage for the TTL level serial ports on the 18F452.
RS485 is more practical for multipoint serial communications.

Yes, obviously. He mentioned in an earlier post he was using a MAX232 to his PC. I didn't feel the need to mention that since he already has it figured.
 
Yes RS485 could be the solution but i will need 6 number of IC's to finish this task because it is a half duplex.

is there any other simple hardware less circuitry solution availabe/possible?
 
Yes RS485 could be the solution but i will need 6 number of IC's to finish this task because it is a half duplex.

is there any other simple hardware less circuitry solution availabe/possible?

Where did RS-485 come from? It hasn't been mentioned from what I can see. Why would you use RS-485 when you would have to convert back to RS-232. Maybe I'm not understanding what you are needing.

What about an RS-232 data switch?
**broken link removed**
 
can i send data to PIC RX1 & PIC RX2 from my PC using two COM ports.

Rezer RS485 is a solution of what i have asked but its emplementation required 6 No. of IC's for a fully functional debugging of data on a single COM port.

I need a simple low cost less circuitry CIRCUIT, so that i will easliy add it up to my all serial port related projects.
 
Ash;

I told you it was more complex then first impressions;)

It's a little difficult to just draw you a design as one could use more details about the application and use. I assume this is for testing and troubleshooting the design and not required for the final product?

If it's just for testing then you need to define if you can utilize a PC with two comm ports or can you have two PC systems available for the testing period? Having two PC would make the testing session a little more straight forward as you won't have to figure out which instance of hyper terminal is active and which COMM port is monitoring which of the two PIC data lines.

If you have only one PC with one COMM port then you have the problem of output data from the PC. How will you determine which PIC signal input will receive the data from the PC, #1 pic, #2 pic or both at the same time without some kind of manual switching function?

Also can the two PICs be sending data to each other at the same time or will data only be sent in one direction at any specific time (half-duplex or full duplex)? If full duplex then you will defenitly need two COMM ports or two computers to do the monitoring as ORing two PIC data streams with one COMM input port will garble data if the two PICs send data at the same time.

The ORing logic needs to be performed on the TTL side of the max232converter(s) of course. If I recall the RS-232/TTL converters utilize a negative logic such that when no data is being send (steady mark condition) the TTL level is at a high state. If that is fact then the ORing function can be performed using a 2 input AND gate (74LS08 should work). If the serial logic level is using positive logic (steady mark condition = TTL high state) then a 74LS32 OR gate would perform the proper function. Each 74LS08 (or 32) has four gate functions avalible.

This ORing function gate would be used where ever you want to have two TTL output pins sending to one TTL input pin. How many Oring function you need again depends on the number of COMM ports or computers you have avalible for testing.

Lefty
 
Last edited:
On a PC with two serial ports, the easiest solution I can see is to write a program that relays the signals. I.E. what comes in com1 goes out com2 and vice versa. It would then be very simple to monitor what is passing back and forward and inject additional data as necessary. There will be a latency of 1 byte between the pics but I can't see any other way to do this without external circuitry.

Mike.
 
Might be fun to daisy chain the serial ports, you'll have to echo the data though.
So TX1 to RX2, TX2 to RX3, TX3 to RX1
Puddles of fun.
 
It's a little difficult to just draw you a design as one could use more details about the application and use. I assume this is for testing and troubleshooting the design and not required for the final product?

Yes it is for testing and trouble shooting the design

If it's just for testing then you need to define if you can utilize a PC with two comm ports or can you have two PC systems available for the testing period? Having two PC would make the testing session a little more straight forward as you won't have to figure out which instance of hyper terminal is active and which COMM port is monitoring which of the two PIC data lines.

Only one PC & one COM port is available.

If you have only one PC with one COMM port then you have the problem of output data from the PC. How will you determine which PIC signal input will receive the data from the PC, #1 pic, #2 pic or both at the same time without some kind of manual switching function?

#1 PIC & #2 PIC response command can be different. For exampl #1 PIC respond on YES & #2 PIC respond on NO only. This can be done in programming.

Also can the two PICs be sending data to each other at the same time or will data only be sent in one direction at any specific time (half-duplex or full duplex)? If full duplex then you will defenitly need two COMM ports or two computers to do the monitoring as ORing two PIC data streams with one COMM input port will garble data if the two PICs send data at the same time.

Yes we will receive garbage data when both PICs send data at a time but this can be fixed by proper time slicing.

The ORing logic needs to be performed on the TTL side of the max232converter(s) of course. If I recall the RS-232/TTL converters utilize a negative logic such that when no data is being send (steady mark condition) the TTL level is at a high state. If that is fact then the ORing function can be performed using a 2 input AND gate (74LS08 should work). If the serial logic level is using positive logic (steady mark condition = TTL high state) then a 74LS32 OR gate would perform the proper function. Each 74LS08 (or 32) has four gate functions avalible.

This ORing function gate would be used where ever you want to have two TTL output pins sending to one TTL input pin. How many Oring function you need again depends on the number of COMM ports or computers you have avalible for testing.


Need a schematic diagram to elaborate it practically
 
Status
Not open for further replies.

Latest threads

Back
Top