文档详情

can(can接口编程实例)(国外英文资料).doc

发布:2017-06-07约1.46万字共22页下载文档
文本预览下载声明
can(can接口编程实例)(国外英文资料) / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * function description: after receiving the data from the serial port communication from the PC, all the receiving data will be forwarded to the experimental board (from CAN) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / # include pic18.h / * pic18 series header file * / Char CAN_TX_Adress_H, CAN_TX_Adress_L / * CAN send mailbox identifier high and low byte * / Char CAN_RX_Adress_H. / * CAN receive mail identifier high and low byte * / Int CAN_FLAG; / * = 1 receives the CAN data, = 0 does not receive data * / Unsigned char receive_count = 0; / * 232 serial port receives the data number register * / Unsigned char send_count = 0; / * 232 serial port sends the data number register * / Unsigned char * pointer; / * 232 serial port sends pointer * / Unsigned char SciReceiveFlag; / * = 1 serial port receives 8 data, = 0 does not receive 8 data * / Unsigned char receive232 [20]. / * 232 collinage to receive the data array * / Unsigned char send232 [20]. / * 232 serial port sends the data array * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * () : initial () * * function description: system initializer, put in the program header * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / Void initial () { INTCON = 0 x00; / * bit7 - bit0: total interruption * / ADCON1 = 0 x07; / * sets the number input to the export / PIE1 = 0; / * the interruption of PIE1 does not allow for * / PIE2 = 0; / * the interruption of PIE2 does not allow for * / PIE3 = 0; / * the interruption of PIE3 does not allow for * / } / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
显示全部
相似文档