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:

Difference between revisions of "DsPIC Block/SPI Input Output"

From - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
Jump to navigation Jump to search
Line 38: Line 38:
Provides information like bit rate and status
Provides information like bit rate and status
<comments \>

Revision as of 19:00, 26 April 2010

Block SPI Input/Output

Input-Output Driver for SPI module

The SPI Input-Output block can be configured as an input for SPI data, as an SPI output, or as both Input-Output. The SPI pin can be disabled after reading or sending data allowing the pin tu be used as a digital output (usefull if weird protocole is used)

Dialog Box Parameters

SPI Input Output Dialog
Example of SPI block reading data from an rate-gyro (ADIS16100). Chip Select of the rate gyro is connected to the B4 dsPIC pin which is activated just before execution of the SPI block. Note the Ordering connection to force block ordering.

n° SPI

SPI used

SPI Input

If checked, SPI data will be read This add one output to the Simulink block.

Wait for previous operation to finish, and Reset before Read

Wait for previous operation to finish, and Reset before Read

SPI Output

When checked, SPI data will be written to the SPI pin. This add one input to the Simulink block.

Special SPI

Allow to disable SPI pin function and to use theses pin as digital input/output. The choices are :

  • Always Enable
  • Disable After block execution
  • Re-Enable before block execution
  • Re-Enable Execute and disable

Data Length

8 or 16 bits. This option is set in SPI Configuration block

Wait for incomming data (slave mode)

Stop execution of other blocks while no data are received

Block Ordering Input / Output

Create one input and/or output port on simulink. This port is just used to set the order of execution between severals blocks. You want for example inside one time step set a pin to its high value and to its low value just after (create a glitch). You will used two blocks digital output, but they should be activated in a certain order. Connecting the first block to the second one (temporaly speaking) will allow to respect the execution order you desire.


Provides information like bit rate and status

<comments \>