mikroElektronika PIC Microcontrollers PIC12 User Manual page 158

Mikroc user's manual
Table of Contents

Advertisement

mikroC - C Compiler for Microchip PIC microcontrollers
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 ..
page
150
&
&
&
&
&
MikroElektronika: Development tools - Books - Compilers
mikroC
making it simple...

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents