data packet definition, data acquisition!

Discussion in 'Embedded Systems and Microcontrollers' started by Eric007, Apr 29, 2012.

  1. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!

    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?
  2. MrChips

    MrChips Moderator Staff Member

    Joined:
    Oct 2, 2009
    Messages:
    9,904
    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.
    Eric007 likes this.
  3. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    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

    Attached Files:

  4. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    And as for the 'USB to RS232 adapter' for both PCs I can use either of the one attached, right?

    Attached Files:

  5. MrChips

    MrChips Moderator Staff Member

    Joined:
    Oct 2, 2009
    Messages:
    9,904
    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?)
  6. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    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??

    Attached Files:

  7. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    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!
  8. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    Somebody address my posting #46 and #47 please...

    Thanks!
  9. bertus

    bertus Administrator Staff Member

    Joined:
    Apr 5, 2008
    Messages:
    12,631
    Location:
    Amsterdam,Holland (GMT + 1)
  10. t06afre

    t06afre AAC Fanatic!

    Joined:
    May 11, 2009
    Messages:
    5,939
    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.
    Eric007 likes this.
  11. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    You got me perfectly right!

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

    Thanks!
  12. Eric007

    Eric007 Thread Starter Active Member

    Joined:
    Aug 5, 2011
    Messages:
    994
    Location:
    Paris, France!
    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 !
Similar Threads
Forum Title Date
Embedded Systems and Microcontrollers AT89C51ac3 serial data packet problem Jan 24, 2010
Embedded Systems and Microcontrollers Understanding datasheet sensor Oct 10, 2014
Embedded Systems and Microcontrollers MFRC522 Datasheet Oct 5, 2014
Embedded Systems and Microcontrollers Data type inside struct for bit define Sep 9, 2014
Embedded Systems and Microcontrollers Efficient method to handle data types Sep 8, 2014

Share This Page