Location:
Search - pic int
Search list
Description: 自己编写的一个PIC程序,可实现0—99记数并通过数码管显示,应用了TMR0中断。-themselves prepared a PIC procedure can achieve 0-99 counting and through digital control, Application of TMR0 interruption.
Platform: |
Size: 1302 |
Author: 张丛 |
Hits:
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: 自己编写的一个PIC程序,可实现0—99记数并通过数码管显示,应用了TMR0中断。-themselves prepared a PIC procedure can achieve 0-99 counting and through digital control, Application of TMR0 interruption.
Platform: |
Size: 1024 |
Author: 张丛 |
Hits:
Description: timer int for pic 16f8-timer int for pic 16f877
Platform: |
Size: 1024 |
Author: Thang |
Hits:
Description: PIC单片机电动车解决方案,/电动车双闭环程序,采用双闭环方式控制电机,以得到最好的zh转速性能,并且可以
//限制电机的最大电流。本应用程序用到两个CCP部件,其中CCP1用于PWM输出,以控
//制电机电压;CCP2用于触发AD,定时器TMR2、TMR1,INT中断,RB口电平变化中断,
//看门狗以及6个通用I/O口-BIKE
Platform: |
Size: 50176 |
Author: 刘 |
Hits:
Description: PIC 16F684 外部脉冲计数,74hc595显示,两路AD采集-PIC 16F684 external pulse count, 74hc595 show that two-way AD acquisition
Platform: |
Size: 1024 |
Author: armlinuxvc |
Hits:
Description: PIC16F877单片机使用外部中断最简单的演示程序,适合PIC单片机初学者使用。-PIC16F877 MCU external interrupt most simple demonstration program, suitable for PIC microcontrollers for beginners to use.
Platform: |
Size: 23552 |
Author: LHT |
Hits:
Description: PIC program about PORT,AD,INT etc.-pic
Platform: |
Size: 7168 |
Author: 123456 |
Hits:
Description: /这是一个两路交流信号的AD转换,然后和标准比较决定输出大于标准的那一路,默认输出A路
#include <pic.h>
#include <math.h>
#include <stdio.h>
bank1 int re0[40] //定义存放A/D转换结果的数组,在bank0中
bank1 int re1[40] //定义存放A/D转换结果的数组,在bank1中-/ This is a two way exchange of signals AD conversion, and then compare the decision and the standard output that is larger than the standard way, the default output A Way# include <pic.h># Include <math.h># Include <stdio.h> bank1 int re0 [40] // definition of stored A/D conversion results in an array, in bank0 in bank1 int re1 [40] // definition of stored A/D conversion results in an array, in bank1 in ~ ~ ~ ~
Platform: |
Size: 2048 |
Author: mengchao |
Hits:
Description: PIC 外部中断,中断口RB0中断流水灯-PIC external interrupt
Platform: |
Size: 10240 |
Author: 346T |
Hits:
Description: PIC单片机PIC16F676外部中断与定时中断同时使用PWM输出程序源码,有详细说明,欢迎下载学习。-PIC16F676 PIC microcontroller with an external interrupt timer interrupt program source code while using the PWM output
Platform: |
Size: 33792 |
Author: vince |
Hits:
Description: 上传截切图片到服务器硬盘上,现显示到网页上 Default3.aspx---System.Drawing.Image image = Clipboard.GetImage()
-Upload Images Using C#
System.Drawing.Image image = Clipboard.GetImage()
if (image != null)
{
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(image)
int i = DateTime.Now.Millisecond
string filename = "pic"+ i+ ".jpg"
string path = @"d:\stu\DemoTest09\DemoTest09\update_gif\"+ filename
bitmap.Save(path)
TextBox1.Text = path
img1.Src = @"./update_gif/"+ filename
Image1.ImageUrl = @"./update_gif/"+ filename
image2.Src = @"./update_gif/"+ filename
aid01.HRef = @"./update_gif/"+ filename
}
Platform: |
Size: 398336 |
Author: 李信 |
Hits:
Description: PIC单片机INT中断的程序参考,一个INT中断应用的简单示例程序。-INT interrupt the program PIC microcontroller reference, a simple example INT interrupt application procedures.
Platform: |
Size: 1024 |
Author: 江元 |
Hits:
Description: Test a interrupt (USAR/INT/EXTERNAL) for PIC 16F877.
Platform: |
Size: 175104 |
Author: marcante |
Hits:
Description: 单片机MCC 18 pic 中断程序,是外部中断。-PIC INT
Platform: |
Size: 2048 |
Author: 张兵 |
Hits:
Description: PIC编程实例第六章,包含3个程序,如下:S061: INT 中断例子
S062: B口高四位中断例子
answer: 习题编程题例程
-
PIC programming examples in Chapter VI contains three programs, as follows: S061: INT interrupt example
S062: B port interrupt high four examples
answer: Exercise programming routines title
Platform: |
Size: 212992 |
Author: 吴亮 |
Hits:
Description: 自己编写的一个PIC程序,可实现0—99记数并通过数码管显示,应用了TMR0中断。-themselves prepared a PIC procedure can achieve 0-99 counting and through digital control, Application of TMR0 interruption.
Platform: |
Size: 1024 |
Author: pressbri |
Hits:
Description: timer int for pic 16f8-timer int for pic 16f877
Platform: |
Size: 1024 |
Author: isalso |
Hits:
Description: Interrupt for PIC16F887
Platform: |
Size: 59392 |
Author: Balvin |
Hits: