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: 2020-05-12
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: CAN
Downloaded: 2602 times
Not followed.
License: MIT license
The CAN FD 4 Click is a Click board that features the NCV7344D10R2G, a Controller Area Network (CAN) transceiver, from ON Semiconductor.
Do you want to subscribe in order to receive notifications regarding "CAN FD 4 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "CAN FD 4 click" changes.
Do you want to report abuse regarding "CAN FD 4 click".
Library Description
Library provides functions for communication via UART module, and a function for controlling cs pin, which sets device mode.
Key functions:
void canfd4_write_byte ( uint8_t input )
- Writes single byte of datauint8_t canfd4_read_byte( )
- Reads single byte of datauint8_t canfd4_byte_ready ( )
- Checks if new data ic receivedExamples description
The application is composed of three sections :
void application_task ( )
{
char tmp;
uint8_t drdy_flag;
if ( app_mode == APP_MODE_RECEIVER )
{
// RECEIVER - UART polling
drdy_flag = canfd4_byte_ready( );
if ( 1 == drdy_flag )
{
tmp = canfd4_read_byte( );
mikrobus_logWrite( &tmp, _LOG_BYTE );
}
}
else
{
// TRANSMITER - TX each 2 sec
for ( tmp = 0; tmp < 9; tmp++ )
{
canfd4_write_byte( demo_message_data[ tmp ] );
mikrobus_logWrite( ">> MESSAGE SENT <<", _LOG_LINE );
}
Delay_ms(2000);
}
}
Other mikroE Libraries used in the example:
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.