User`s manual

This code demonstrates use of CAN library routines:
program CAN
dim aa as byte
dim aa1 as byte
dim lenn as byte
dim aa2 as byte
dim data as byte[8]
dim id as longint
dim zr as byte
dim cont as byte
dim oldstate as byte
sub function TestTaster as byte
result = true
if Button(PORTB, 0, 1, 0) then
oldstate = 255
end if
if oldstate and Button(PORTB, 0, 1, 1) then
result = false
oldstate = 0
end if
end sub
main:
TRISB.0 = 1
' designate pin RB0 as input
PORTC = 0
TRISC = 0
PORTD = 0
TRISD = 0
aa = 0
aa1 = 0
aa2 = 0
aa1 = CAN_TX_PRIORITY_0 and
' form value to be used
CAN_TX_XTD_FRAME and
' with CANSendMessage
CAN_TX_NO_RTR_FRAME
aa = CAN_CONFIG_SAMPLE_THRICE and
' form value to be used
CAN_CONFIG_PHSEG2_PRG_ON and
' with CANInitialize
CAN_CONFIG_STD_MSG and
CAN_CONFIG_DBL_BUFFER_ON and
CAN_CONFIG_VALID_XTD_MSG and
CAN_CONFIG_LINE_FILTER_OFF
' continues..
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
122
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Example