17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

#int_canrx0<br />

#int_canrx1<br />

This interrupt is triggered when a message is<br />

received in buffer 0.<br />

This interrupt is triggered when a message is<br />

received in buffer 1.<br />

Relevant Include Files:<br />

can-mcp2510.c<br />

can-18xxx8.c<br />

can-18F4580.c<br />

Drivers for the MCP2510 and MCP2515 interface<br />

chips<br />

Drivers for the built in CAN module<br />

Drivers for the build in ECAN module<br />

Relevant getenv() Parameters:<br />

none<br />

Example Code:<br />

can_init();<br />

can_putd(0x300,data,8,3,TRUE,FALSE);<br />

can_getd(ID,data,len,stat);<br />

// initializes the CAN bus<br />

// places a message on the CAN buss with<br />

// ID = 0x300 and eight bytes of data pointed to by<br />

// “data”, the TRUE creates an extended ID, the<br />

// FALSE creates<br />

// retrieves a message from the CAN bus storing the<br />

// ID in the ID variable, the data at the array pointed<br />

to by<br />

// “data', the number of data bytes in len, and<br />

statistics<br />

// about the data in the stat structure.<br />

CCP1<br />

These options lets to configure and use the CCP module. There might be multiple CCP modules<br />

for a device. These functions are only available on devices with CCP hardware. They operate in<br />

3 modes: capture, compare and PWM. The source in capture/compare mode can be timer1 or<br />

timer3 and in PWM can be timer2 or timer4. The options available are different for different<br />

devices and are listed in the device header file. In capture mode the value of the timer is copied<br />

to the CCP_X register when the input pin event occurs. In compare mode it will trigger an action<br />

when timer and CCP_x values are equal and in PWM mode it will generate a square wave.<br />

Relevant Functions:<br />

setup_ccp1(mode)<br />

set_pwm1_duty(value)<br />

Sets the mode to capture, compare or PWM. For capture<br />

The value is written to the pwm1 to set the duty.<br />

46

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!