data packet definition, data acquisition!

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Oops, my mistake. I forgot you are using a USB to UART bridge.
The PC will assign a COMx port to the USB when the cable is connected.
Usually it is consistent but it can be any number on a different PC. So you have to allow the user to select the COMx port.

ok! so like I was saying earlier...at program startup, PC automatically detects the COM port available in the computer and allow the user to select the port to which the cable has been connected to, correct?

But as for the baude rate, I must stick with one ONLY to avoid complexity, right?

a little question, the fact thaT ONLY one cable will be connected the program will display only one portname, right?
 

MrChips

Joined Oct 2, 2009
30,802
I don't think so. Your program has to ask the OS what ports are connected and the OS will respond with any number of ports. Otherwise your program has to try to open a specific port but you have no way of knowing which COM port is the serial port.

The way I determine it is I look at the COM ports via the Device Manager. When you plug in the USB cable you will see a new COM port appear in the hardware list.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
we been talking about direct communication between 2 PCs via cable earlier...and this was for the simulation

Now assuming you want to do the actual communication between the PC and microcontroller and that you already connected the USB to RS232 serial adapter on the PC.

So the null modem cable I am going to use to connect PC and microcontroller is as attached, right?
and there will be an RS232 adapter (female) on microcontroller side, right?
Thanks
 

Attachments

MrChips

Joined Oct 2, 2009
30,802
For connecting the PC to the micro you only use the USB to RS-232 cable. You do not use the null modem. I assume you or someone is designing the microcontroller board. Hence you would connect the TXD and RXD pins from the MCU to a MAX232 (or similar) transceiver chip and you would wire the MAX232 RS-232 connections to match the RS-232 to USB cable.

(If you wanted you could configure the MCU to be Data Terminal Equipment (DTE), the same as a PC, in which case you would need a NULL MODEM cable. But what is the point?)
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
the connection for PC to PC will be as attached (between male and female), right?

Now what kind of connectors to use to do this kind of connection??
 

Attachments

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
If you do not use handshake. And also turn it off then using a terminal program like hyperterm. Or in your program. It will work using only pin 5, 3, and 2. Pin 2 and 3 must be crossed in the cable.
Hope this will help you
I will have to cross pin2 and pin3 as you said. Pin5 connected to pin5.
These connection will be done one at a time.

My concern is: what type of connectors must I use? Wires I use when breadboarding or there are some special connectors?

Remember connection will be done between a pin and a hole (RS232 pin with null modem cable hole or socket) like I showed in that image in above picture.

Thanks!
 

t06afre

Joined May 11, 2009
5,934
Also remember in a proper null-modem cable the crossing will be done inside the cable. For your project you will have to use 9 PIN D-SUB FEMALE connector to connect to the USB to serial connector. In the other end you can use the connector you think will be best. What is important is that the transmit signal/pin in one end. Is connected to the receive signal/pin in the other end. The signal leaving as outgoing in one end. Must necessarily become an input signal in the other end. Nothing good will come out of connecting to transmitters to each other.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Also remember in a proper null-modem cable the crossing will be done inside the cable. For your project you will have to use 9 PIN D-SUB FEMALE connector to connect to the USB to serial connector. In the other end you can use the connector you think will be best. What is important is that the transmit signal/pin in one end. Is connected to the receive signal/pin in the other end. The signal leaving as outgoing in one end. Must necessarily become an input signal in the other end. Nothing good will come out of connecting to transmitters to each other.
You got me perfectly right!

I'm trying to hook up with some connectors...

Thanks!
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Big Thanks to T0fafre and Mrchips!!!

All my connections worked perfectly and I was able to do a serial communication with 2 Pcs...

When I have a chance I will discuss the same thing but this time between the microcontroller and a PC. This will be for my own learning...knowledge...no school thang....

Thanks !
 
Top