Simulating an RS232 Serial Port on a PC

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
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?
 

MikeML

Joined Oct 2, 2009
5,444
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?
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.
 

ErnieM

Joined Apr 24, 2011
8,377
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).
 

MrChips

Joined Oct 2, 2009
30,823
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.
 

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
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
 

Papabravo

Joined Feb 24, 2006
21,227
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
 
Top