We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-08-01
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: CAN
Downloaded: 11879 times
Followed by: 2 users
License: MIT license
This is code that shows simple connection of two CAN SPI modules with SN65HVD230.<br/>
Messages are sent by pressing PortB buttons and received message can be seen on PortD LEDs.<br/>
Do you want to subscribe in order to receive notifications regarding "CAN SPI 3.3V click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "CAN SPI 3.3V click" changes.
Do you want to report abuse regarding "CAN SPI 3.3V click".
Front and back view of CAN SPI 3.3V click board designed in mikroBUS form factor. mikroBUS is specially designed pinout standard with SPI, I2C, Analog, UART, Interrupt, PWM, Reset and Power supply pins.
View full imageLibrary Description
The library covers all the necessary functions to control CAN SPI 3v3 click board.
Key functions:
void canspi3v3_hwReset()
- Hardware reset function.uint8_t canspi3v3_getInterrupt()
- Get interrupt state function.The application is composed of the three sections :
void applicationTask() { char dataRxTx[ 8 ]; uint8_t dataRxLen; uint8_t msgRcvd; uint8_t dataTx; uint32_t idRx; dataTx = 0xAB; msgRcvd = CANSPIRead( &idRx , &dataRxTx , &dataRxLen, &canRcvFlags ); if ( msgRcvd ) { mikrobus_logWrite( &dataRxTx, _LOG_BYTE ); Delay_1sec(); } // CANSPIWrite( id2nd, dataTx, 1, canSendFlags ); // mikrobus_logWrite( "MESSAGE SENT", _LOG_LINE ); // Delay_1sec(); }
Other mikroE Libraries used in the example:
SPI
CAN_SPI
UART
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.