Mikroc, Library example – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 158

Advertising
background image

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

150

MikroElektronika: Development tools - Books - Compilers

page

Library Example

unsigned short

aa, aa1, len, aa2;

unsigned char

data[8];

long

id;

unsigned short

zr, cont, oldstate;

//........

void

main() {

PORTC = 0;

TRISC = 0;

PORTD = 0;

TRISD = 0;

aa = 0;

aa1 = 0;

aa2 = 0;

// Form value to be used with CANSendMessage

aa1 = CAN_TX_PRIORITY_0 &

CAN_TX_XTD_FRAME &

CAN_TX_NO_RTR_FRAME;

// Form value to be used with CANInitialize

aa = CAN_CONFIG_SAMPLE_THRICE

&

CAN_CONFIG_PHSEG2_PRG_ON

&

CAN_CONFIG_STD_MSG

&

CAN_CONFIG_DBL_BUFFER_ON

&

CAN_CONFIG_VALID_XTD_MSG

&

CAN_CONFIG_LINE_FILTER_OFF;

data[0] = 0;

// Initialize CAN

CANInitialize(1,1,3,3,1,aa);

// Set CAN to CONFIG mode

CANSetOperationMode(CAN_MODE_CONFIG,0xFF);

id = -1;

// continues ..

Advertising
This manual is related to the following products: