傳送帶物品計(jì)數(shù)器的設(shè)計(jì)帶仿真
仿真文件的下載地址:http://www.51hei.com/f/csdwpjs.rar
#include"lcd1602.h"
#define uchar unsigned char
#define uint unsigned int
uchar out[6];
sbit STAR_KEY =P3^2;//定義鍵與單片機(jī)的連接引腳
sbit L0=P1^0; //定義SFR中引腳的位
sbit L1=P1^1;
sbit L2=P1^2;
sbit L3=P1^3;
sbit L4=P1^4;
sbit L5=P1^5;
sbit L6=P1^6;
sbit L7=P1^7;
sbit MOTOR=P3^0;
uchar n[2]={1,0};
void delayms(uint x) //延時(shí)子程序
{
uchar y;
while(x--)
{
for(y=0;y<123;y++){;}
}
}
uchar Keynum() //按鍵子程序1
{
uchar key=0;
STAR_KEY=1; //置初值
if(STAR_KEY==0){delayms(10);if(STAR_KEY==0)n[0]=0;n[1]=1;} //按下STAR鍵則n[0]=0;n[1]=1
return n[1]; //返回n值
}
void xianshi(uint dispbuf) //顯示子程序
{
out[0]=dispbuf/10000+0x30;
out[1]=((dispbuf%10000)/1000)+0x30;
out[2]=((dispbuf%1000)/100)+0x30;
out[3]=((dispbuf%100)/10)+0x30;
out[4]=dispbuf%10+0x30;
out[5]=