• Hi,
    I want to interface MATLAB with PIC, to do SCADA. MATLAB communicate with USB port, then I have USB-to-UART converter to connect to PIC.
    Does anybody have source to do this? It's is doing in GUI or m file?
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
  • Ashraf HZ

    MemberDec 4, 2010

    Hey shahrul,

    I'm assuming the USB-UART converter is a serial port emulator. In Matlab, you just need to create a serial port object, open it, then read the data. At the most simple, the code will be:

    s = serial('COM1'); % Create serial port object s
    fopen(s); %open port
    x = fscanf(s); % read data into variable x
    fclose(s) % close port
    clear s
    The above code assumes you are using COM1 port for the USB serial emulator. You should change accordingly. Also, 8N1 parameter is used as default. Of course, you may need to code more according to your project, refer to the Matlab reference below:

    Are you sure? This action cannot be undone.
  • shahrul

    MemberDec 5, 2010

    Thanks, I will try.
    Are you sure? This action cannot be undone.
Home Channels Search Login Register