Mikroelektronika MIKROE-350 Datenbogen

Seite von 526
CANSPISetOperationMode
CANSPIGetOperationMode
174
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure CANSPISetOperationMode(dim mode as bytedim WAIT
as byte)
Returns
Nothing.
Description
Sets the CANSPI module to requested mode.
Parameters : 
mode:
CANSPI module operation mode. Valid values: 
CANSPI_OP_MODE
con-
stants (see CANSPI constants). 
WAIT:
CANSPI mode switching verification request. If 
WAIT = 0
, the call is non-
blocking. The sub function does not verify if the CANSPI module is switched to
requested mode or not. Caller must use 
CANSPIGetOperationMode
to verify correct
operation mode before performing mode specific operation. If 
WAIT != 0
, the call is
blocking – the sub function won’t “return” until the requested mode is set. 
Requires
The CANSPI routines are supported only by MCUs with the SPI module.
MCU has to be properly connected to mikroElektronika's CANSPI Extra Board
or similar hardware. See connection example at the bottom of this page.
Example
' set the CANSPI module into configuration mode (wait inside
CANSPISetOperationMode until this mode is set)
CANSPISetOperationMode(CANSPI_MODE_CONFIG, 0xFF)
Prototype
sub function CANSPIGetOperationMode() as byte
Returns
Current operation mode.
Description
The sub function returns current operation mode of the CANSPI module. Check
CANSPI_OP_MODE
constants (see CANSPI constants) or device datasheet for
operation mode codes.
Requires
The CANSPI routines are supported only by MCUs with the SPI module.
MCU has to be properly connected to mikroElektronika's CANSPI Extra Board
or similar hardware. See connection example at the bottom of this page.
Example
' check whether the CANSPI module is in Normal mode and if it is
do something.
if (CANSPIGetOperationMode() = CANSPI_MODE_NORMAL) then
...
end if