Simulating an RS232 Serial Port on a PC

Discussion in 'Embedded Systems and Microcontrollers' started by Dawud Beale, Dec 19, 2014.

  1. Dawud Beale

    Thread Starter Member

    Feb 10, 2012
    Hi everyone. I am attempting to transmit and receive serial data from a USB port on a PC. I want it to be transmitted as RS232 serial data. MATLAB will be sending the signal.

    My question is, is there a simulator for the PC ports so that I don't have to physically buy a USB to USB cable?
  2. MaxHeadRoom


    Jul 18, 2013
    There are drivers for setting USB port for RS232, 3 wire connection.
    $1.50 p.p. ebay 301227341140
    Last edited: Dec 19, 2014
  3. MikeML

    AAC Fanatic!

    Oct 2, 2009
    Your question does not make sense. If the PC has only USB, then you need a USB-to-serial-converter as a dongle on the USB cable. There are drivers that must be installed in the PC to make it believe that it has a serial port. Presumably, MATLAB knows how to talk to a serial port, but not to USB.
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Windows comes with drivers for what is called a "virtual COM port" which means a USB to serial communications.

    Physically you will need that cable to make it output something. I am unsure if you can just connect TX to RX and readback the information inside MATLAB (which I do not use).
  5. MrChips


    Oct 2, 2009
    Get a CP2102 adapter like I suggested in your other thread. Plug it into a USB port and in appears as a COM port on your PC. Open the Device Manager and look up which COM port it is. From MATLAB open the COM port assigned to it and you're ready to go.

    I do it all the time.
  6. Dawud Beale

    Thread Starter Member

    Feb 10, 2012
    What I meant was, connected Tx to Rx so that I am transmitting data from the PC back to the PC again. I wanted to send RS232 data from the PC via the USB port and then pick the data up again on a second USB port. But rather than buy cables, I wanted a simulator. I have noticed in some youtube vids they have simulators that simulate the ports so that you can transmit and receive the data without having any physical hardware. The simulator acts like hardware
  7. Papabravo


    Feb 24, 2006
    AFAIK you would get this behavior by creating a pair of tasks that exchanged data via shared memory. No need for messy hardware at all. Are you familiar enough with a PC OS that you could do this yourself? I recommend:
    Petzold,Programming Windows 95, for a primer on the subject