Blockset described on this wiki is deprecated since 2012.

For Model Based Design (MBD), use the free MPLAB Device Blocks for Simulink, tool from Microchip.
Updated Rapid Control Prototyping (RCP) custom projects are published at: https://lubin.kerhuel.eu.

DsPIC Block/Interface Tx-Matlab

From http://www.kerhuel.eu/wiki - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
< DsPIC Block
Revision as of 22:43, 26 May 2008 by LubinKerhuel (talk | contribs) (New page: Open Graphical User Interface to receive data from the microcontrollers throw the PC serial port. Data can be plotted in real time. Double click on this block open the GUI to log data fro...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Open Graphical User Interface to receive data from the microcontrollers throw the PC serial port. Data can be plotted in real time.

Double click on this block open the GUI to log data from the dsPIC into matlab.


Interface PIC-Matlab

Set the connexion of the PC serial port. You can select the COM port used, the baudrate ( select the same used by the dsPIC) and the hardware control flow (usually, set to none if you are using a simple wire. if you use aerial module like bluetooth, you need perhaps the hardware control Flow).

The connexion and Reset button connect and release the COM port. Once the connexion is set, modification of port parameters has no influence. When connecting, some Windows crash if the dsPIC is sending data. If so, disconnect the PIC while pushing the connection button.

The data received are decoded using the PIC - Matalb protocole created and stored into the R matrix. Each column of R correspond to one channel. R growth until its size reach the buffer size (here 50000). Then, oldest data are deleted so as to retain into R the last 50000 data received.

The Rn matrix is a subset of the R matrix. Rn contain the last 10000 values of R. The size of R can be set. Rn is the matrix used for real time plotting.

The large text box s to enter matlab command that are interpreted after the delay during which data are received (1s here). You can enter any valid Matlab command. It is also possible to call a matlab file you previously wrote. The four buttons Default, Dflt signe, Simulink, Emission are four example of pre-recorded script. Default is to plot unsigned data. Dflt signe allow to plot signed int16 data.

Start and Stop button is for start and stop the reception-execution of the script. Do not forget to release the COM port before leaving.