Location:
Search - TECH PICC18
Search list
Description: 、 先在microchip网站上找到00738.zip,这个包中有
can18xx8.h,can18xx8.c,将其复制到一个你要编写程度的子目录中,例如C:\testcan下,这个时候这个东东是不能直接用的。
2、 下载一个MPLAB 7.10,直接安装(要求直接下载)
3、 再下载一个PICC18 (HI-TECH的),要正版哦(支持正版,买不起的想其它办法吧)
4、在你的头文件上写上如下的样式:
#include "stdio.h"
#include "can18xx8.h"
#include "pic18fxx8.h"//可能是“pic.h”不太好包含,因此常会报错,直接包含克服之
5、然后设置好PICC和MPLAB,如果MPLAB上没有PICC18,则到PICC的网上下一个安装软件,可以直接运行安装就有了。
6、按照工程的基本要求把你的源代码、添加上两个库(不加也可以)
然后就可以写如下代码了:下面是一个完整版,可以直接使用microchip的库函数,本程序只是仿真调试过,未在多个芯片通信过,仍在制作中。
#include "stdio.h"
#include "can18xx8.h"
#include "pic18fxx8.h"
unsigned long NewMessage;
BYTE NewMessageData[8];
BYTE MessageData[8];
BYTE NewMessageLen;
enum CAN_RX_MSG_FLAGS NewMessageFlags=1;
BYTE RxFilterMatch;
void main()
{
//int a;
//int b;
CANInitialize(1, 5, 7, 6, 2, CAN_CONFIG_VALID_XTD_MSG);
while(1)
{
// Application specific logic here
// Check for CAN message
if ( CANIsRxReady() )
{
CANReceiveMessage(&NewMessage,NewMessageData,&NewMessageLen,&NewMessageFlags);
if ( NewMessageFlags & CAN_RX_OVERFLOW )
{
// Rx overflow occurred; handle it
}
if ( NewMessageFlags & CAN_RX_INVALID_MSG )
{
// Invalid message received; handle it
}
if ( NewMessageFlags & CAN_RX_XTD_FRAME )
{
// Extended Identifier received; handle it
}
else
{
// Standard Identifier received.
}
if ( NewMessageFlags & CAN_RX_RTR_FRAME )
{
// RTR frame received
}
else
{
// Regular frame received.
}
// Extract receiver filter match, if it is to be used
RxFilterMatch = NewMessageFlags & CAN_RX_FILTER_BITS;
}
// Process received message
// Transmit a message due to previously received message or
// due to application logic itself.
if ( CANIsTxReady() )
{
MessageData[0] = 0x01;
CANSendMessage( 0x02,MessageData,1,CAN_TX_PRIORITY_0
&CAN_TX_STD_FRAME &
CAN_TX_NO_RTR_FRAME);
}
// Other application specific logic
} // Do this forever
// End of program
}
以上均是参考文档并进行了修正,由于中间总是报错,为了大家让CAN更容易,谢谢大家!
Platform: |
Size: 10682 |
Author: lovelzs2008@126.com |
Hits:
Description: 英文版 HI-TECH PICC18 STD 最详细最权威的开发手册-The English version of HI-TECH PICC18 STD most detailed development of the most authoritative manual
Platform: |
Size: 6715392 |
Author: 陈培国 |
Hits:
Description: 根据HI-TECH PICC18原版BOOTLOADER改进的适合PIC18F4580的BOOTLOADER程序。对HEX文件有要求,HEX32格式,在MPLAB中用编译后导出方式生成,不能直接用编译生成的的HEX文件,否则会不成功。-According to the original HI-TECH PICC18 BootLoader improved BootLoader procedures for the PIC18F4580. HEX file a request for, HEX32 format used in MPLAB compiled Export generated, can not be directly generated by the compiler of the HEX file, otherwise they will be unsuccessful.
Platform: |
Size: 73728 |
Author: 陈培国 |
Hits:
Description: HITECH PICC18 V9.61 pro crack
Platform: |
Size: 1228800 |
Author: snoopy |
Hits:
Description: PICC9.60PL5 PRO版,很新的了。-PICC9.60PL5 PRO version of the very new.
Platform: |
Size: 5969920 |
Author: yanxinming |
Hits:
Description: HI-TECH PICC18编译器,但是我的注册码生成器不好用了-HI-TECH PICC18 compiler, but I am not the key generator with the
Platform: |
Size: 6329344 |
Author: nene |
Hits:
Description: picC语言开发环境,用于pic单片机c语言开发-pic mcu pic mcu pic mcu pic mcu pic mcu pic mcu pic mcu pic mcu pic mcu
Platform: |
Size: 7742464 |
Author: 李芳 |
Hits:
Description: HI-TICH-picc9.60编译器,最新的编译器和破解文件,保证能用-HI-TICH-picc9.60 compiler, the latest compiler and crack files, can be used to ensure
Platform: |
Size: 7052288 |
Author: hxn |
Hits:
Description:
Platform: |
Size: 27302912 |
Author: raham |
Hits: