Mikroelektronika MIKROE-442 데이터 시트
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
301
ECANxDmaChannelInit
ECANxSetOperationMode
Prototype
sub function ECANxDmaChannelInit(dim DmaChannel as word, dim ChannelDir as
word, dim DmaRamBuffAdd as word) as word
Description The function preforms initialization of the DMA module for ECAN.
Parameters -
Parameters -
DmaChannel
: DMA Channel number. Valid values:
0..7
.
-
ChannelDir
: transfer direction. Valid values:
1
(DMA RAM to peripheral) and
0
(peripheral to DMA
RAM).
-
DmaRamBuffAdd
: DMA RAM buffer address. DMA RAM location is MCU dependent, refer to
datasheet for valid address range.
Returns
-
0
- if DMA channel parameter is valid
-
0x0001
- if DMA channel is already in use (busy)
-
0xFFFF
- if DMA channel parameter is invalid
Requires
The ECAN routines are supported only by MCUs with the ECAN module.
Microcontroller must be connected to ECAN transceiver which is connected to the ECAN bus.
Example
‘ channel 0 will transfer 8 words from dma ram at 0x4000 to ECAN1
ECAN1DmaChannelInit(0, 1, 0x4000)
Notes
- ECAN library routine require you to specify the module you want to use. To select the desired
ECAN module, simply change the letter
x in the routine prototype for a number from 1 to 2.
- Number of ECAN modules per MCU differs from chip to chip. Please, read the appropriate
datasheet before utilizing this library.
Prototype
sub procedure ECANxSetOperationMode(dim mode as word, dim WAIT as word)
Description Sets the ECAN module to requested mode.
Parameters -
Parameters -
mode
: ECAN module operation mode. Valid values:
ECAN_OP_MODE
constants. See ECAN_OP_
MODE constants.
-
WAIT
: ECAN mode switching verification request. If
WAIT == 0
, the call is non-blocking. The
function does not verify if the ECAN module is switched to requested mode or not. Caller must use
ECANxGetOperationMode to verify correct operation mode before performing mode specific operation.
If
WAIT != 0
, the call is blocking – the function won’t “return” until the requested mode is set and no
additional verification is necessary.
Returns
Nothing.
Requires
The ECAN routines are supported only by MCUs with the ECAN module.
Microcontroller must be connected to ECAN transceiver which is connected to the ECAN bus.
Example
‘ set the ECAN1 module into configuration mode (wait inside ECAN1SetOperationMode
until this mode is set)
ECAN1SetOperationMode(_ECAN_MODE_CONFIG, 0xFF)
Notes
- ECAN library routine require you to specify the module you want to use. To select the desired ECAN
module, simply change the letter
x in the routine prototype for a number from 1 to 2.
- Number of ECAN modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.