Matlab serial communication

Discussion in 'General Electronics Chat' started by shaby, Oct 11, 2012.

  1. shaby

    Thread Starter New Member

    Oct 11, 2012
    hello every1..!!

    can any one tell me that how i can do serial communication in matlab???
    through usb port... i want a high and low bit at the output.... usb port have 4pins... how i get the output?? please anyone help me
    Last edited by a moderator: Oct 11, 2012
  2. shaby

    Thread Starter New Member

    Oct 11, 2012
    why no one helps me :(
  3. panic mode

    Senior Member

    Oct 10, 2011
    you didn't provide much info about what exactly you want to accomplish.

    according to it's name, USB is a serial bus, but to many word 'serial' usually means RS232 (although there are many more...). USB has 4 pins, two of them are power and reamining two are data lines. to get actual output at very least you would need a USB to RS232 converter.
  4. Stuntman

    Active Member

    Mar 28, 2011
    Serial ports in MATLAB are not too bad. The help manual within the software will be your best friend. I would include some source code of previous uses, but I don't have access at the moment.

    Going from memory:

    First, find where your USB device is "docking" (com0, com1...).
    Open the serial port to MATLAB. Can't remember command.
    Next, you may have to declare the buffer.
    Now read from the buffer in commanded number of bytes.

    panic... you are thinking low level serial. A PC interprets USB data and can be piped to MATLAB.
  5. MrChips


    Oct 2, 2009
    USB is a serial bus. Two wires are power and ground. Other two wires are differential data.
    You cannot use USB as a single bit output port as you would with a LPT port.