//#include<pic16f886.h>
#include<xc.h>
#pragma config WDTE = OFF
//#define __OSCTUNE 0x0f
//#define __CONFIG1 0x20dc //WDT disabled
//#define __CONFIG1 0x20b4 //WDT disabled
//#pragma config WDT=0
void PortInit(void);
void Timer1Init(void);
void dissect_val(void);
//__CONFIG(MCLRE ON & CP_OFF & CPD OFF & BOREN OFF & WDTE OFF & PWRTE OFF & FOSC_INTRCIO);
int number=5444, temp=0;
unsigned char dig0,dig1,dig2,dig3,dig_no=0;
unsigned char ledseg[10]={0x2f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0xff, 0x6f};
void main()
{
Timer1Init();
PortInit();
dissect_val();
while(1)
{
TMR1ON=1;
switch(dig_no)
{
case 0:
RB0 =1;
PORTA=ledseg[dig0];
break;
case 1:
RB1 =1;
PORTA=ledseg[dig1];
break;
case 2:
RB2 =1;
PORTA=ledseg[dig2];
break;
case 3:
RB3 =1;
PORTA=ledseg[dig3];
break;
}
}
}
void PortInit(void)
{
ANSEL= 0x00;
TRISA= 0x00;
PORTA=0x00;
TRISB= 0X00;
PORTB=0X00;
}
void Timer1Init(void)
{
TMR1H=0xff;
TMR1L=0xb4; //0xb4
T1CON =0x00;//0x00;
INTCON=0xC0;
PIE1=0x01;
PIE2=0x00;
PIR1=0x00;
CM2CON1=0x00;
}
void interrupt Timer1_ISR(void)
{
if(TMR1IF==1)
{
TMR1ON=0;
TMR1IF=0;
// TMR1IE=0;
TMR1H=0xff;
// TMR1L=0xfe;
TMR1L=0xb4; //TMR1L=0xfe;
// PORTA=0x00;
dig_no++;
if(dig_no==4)
{
dig_no=0;
}
TMR1ON=1;
}
}
void dissect_val(void)
{
dig0=number%10; // gets 1's value of number to Segments[0]
temp=number/10;
dig1=temp%10; // gets 10's of number value to Segments[1]
temp=temp/10;
dig2=temp%10; // gets 100's value of number to Segments[2]
temp=temp/10;
dig3=temp%10; // gets 1000's value of number to Segments[3]
}
没有合适的资源?快使用搜索试试~ 我知道了~
led.X.rar_Stepping Stone_micro stepping_world
共41个文件
xml:4个
mk:4个
properties:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 131 浏览量
2022-09-23
00:36:00
上传
评论
收藏 130KB RAR 举报
温馨提示
How to interface LED with Microchip’s PIC microcontroller? How to connect LEDs to a PIC microcontroller? LED interfacing is the stepping stone for microcontroller development. This is a simple embedded program for PIC 16F877A to interface LEDs, suitable for beginners who wish to study basics of embedded microcontroller programming. The program is developed through Micro C compiler, one of the best solutions for embedded programming in PIC family. It is compatible for Windows XP and Windows 7 platforms and comes with internal burning tools. This PIC circuit is a beginner circuit, do this PIC project to explore the world of microcontrollers.
资源推荐
资源详情
资源评论
收起资源包目录
led.X.rar (41个子文件)
led.X
l.obj 8KB
main.c 2KB
dist
default
production
led.X.production.sym 6KB
led.X.production.map 23KB
led.X.production.rlf 90KB
led.X.production.lst 67KB
led.X.production.sdb 7KB
led.X.production.obj 13KB
led.X.production.hxl 2KB
led.X.production.cmf 22KB
led.X.production.elf 16KB
led.X.production.hex 3KB
debug
led.X.debug.obj 13KB
led.X.debug.sdb 7KB
led.X.debug.lst 67KB
led.X.debug.map 23KB
led.X.debug.elf 16KB
led.X.debug.rlf 90KB
led.X.debug.hxl 2KB
led.X.debug.sym 6KB
led.X.debug.cmf 21KB
funclist 234B
nbproject
Package-default.bash 1KB
Makefile-impl.mk 2KB
configurations.xml 5KB
Makefile-local-default.mk 2KB
private
private.xml 209B
configurations.xml 885B
private.properties 0B
Makefile-variables.mk 407B
project.xml 662B
Makefile-default.mk 6KB
Makefile-genesis.properties 396B
project.properties 0B
Makefile 3KB
build
default
production
main.p1 78KB
main.pre 43KB
main.p1.d 84B
debug
main.p1 78KB
main.pre 43KB
main.p1.d 74B
共 41 条
- 1
资源评论
刘良运
- 粉丝: 66
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 王姿.html
- 51单片机学习(1)-软件keil下载
- 历届(第1-21届)希望杯数学竞赛初一试题及答案(最新整理).doc全国数学邀请赛(264页资料)
- 水滴.psd
- TokenPocket_V2.1.2_release.apk
- Apache-druid-kafka-rce.yaml
- 基于C#的ASP.NET数据库原理及应用技术课程指导平台的开发
- 基于ROS的智能车轨迹跟踪算法的仿真与设计源码运用PID跟踪算法.zip.zip
- Bug Bounty Tip - i春秋Self-XSS变废为宝的奇思妙想
- 1991-2015年全国初中化学竞赛复赛试题汇编(212页)(24年竞赛复赛真题).docx天原杯
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功