欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
AVR單片機(jī)pwm程序+仿真_數(shù)顯
[打印本頁]
作者:
jinsheng7533967
時間:
2018-12-16 16:09
標(biāo)題:
AVR單片機(jī)pwm程序+仿真_數(shù)顯
oooooooooooo.jpg
(126.86 KB, 下載次數(shù): 87)
下載附件
2018-12-16 16:06 上傳
#include <iom16v.h>
#define uchar unsigned char
#define uint unsigned int
uchar Table[12]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x79};
uchar Data1[4]={10,0,5,0};
uchar Data2[4]={3,9,1,0};
uchar Key1,Key2;
void DelayMs(uchar i)
{
uchar j;
for(;i!=0;i--)
{
for(j=150;j!=0;j--);
}
}
void Display(uchar *p)
{
uchar i,sel=0x01;
for(i=0;i<4;i++)
{
PORTC=sel;
PORTA=0xff-Table[p[i]];
DelayMs(2);
sel=sel<<1;
}
}
void Sub_Process(uchar *p)
{
uchar temp;
temp=p[1]*10+p[2];
if(temp!=0)
{
temp=temp-1;
p[1]=temp/10;
p[2]=temp%10;
}
}
void Key_Process()
{
if(Key1==1)
{
Add_Process(Data1);
Key1=0;
}
if(Key2==1)
{
Sub_Process(Data1);
Key2=0;
}
}
void Init_IO(void)
{
DDRA=0xff;
PORTA=0xff;
DDRC=0xff;
PORTC=0xff;
DDRB=0x00;
PORTB=0x00;
DDRD=0xff;
PORTD=0xff;
}
void main(void)
{
Init_IO();
TCCR1A=0xc3;
TCCR1B=0x02;
DelayMs(50);
while(1)
{
Key_Process();
Set_Process(Data1);
Display(Data1);
}
}
復(fù)制代碼
完整代碼見附件
pwm_數(shù)顯.zip
(15.36 KB, 下載次數(shù): 52)
2018-12-16 16:09 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
zrb5688
時間:
2018-12-26 17:52
不錯,學(xué)習(xí)了,謝謝樓主分享。
作者:
dhutcb
時間:
2019-5-30 10:20
贊一個,不錯
作者:
yaolong986
時間:
2020-11-24 15:36
不錯,收藏了有用這芯片
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1