📄 lcd.c.bak
字号:
#include <absacc.h>
#include <intrins.h>
#include <reg51.h>
#include <stdio.h>
#include "HZcode.h"
#include "circlecode.h"
#include "DegreePoint.h"
#include "LCD.h"
#include "lcd_show.h"
#include "adc0831.h"
//#include "1302.h"
//#include "key.h"
uchar time0_count; //time0计数器
uchar ucInputValue;
uchar ucLastADValue;
uchar ucInputParam0,ucInputParam1,ucInputParam2;
uchar ucSig10ms,ucPWMZKCnt;
bit bInputChange,bPWMK,bMotorHSpeed;
sbit PWMOut=P2^7;
void DelaySecond(uchar i);
void inputdeal(void);
//time0初始化
void time0_init(void)
{
EA = 1;
ET0 = 1;
TMOD = 0x01;
PT0 = 1;
//TH0 = 0x3C;
//TL0 = 0xB0; //12m晶振 则定时50ms
TH0=0XD8;
TL0=0XF0; //12M晶振 定时10ms
TR0 = 1;
}
void Serial_init(void)
{
TMOD|=0x20; //定时器1模式2
TH1=0xe8; //11.0592 MHz 1200bps baud rate
TL1=0xe8;
TR1=1;
SCON = 0x50; //串行模式1 接受允许
TI=1;
}
void main(void)
{
//uint tmp,tmp2;
// I_init();
/*
char conv[32];
for (i=0;i<32;i++)
conv[i]=HZcode[0][i];
*/
InitLCD();
time0_init();
Serial_init();
Show_Circle();
Show_HalfCircle();
Show_hanzi();
while(1)
{
inputdeal();
if (ucSig10ms!=0)
{
uchar tmp;
ucSig10ms--;
//20ms H 30ms L
//40ms H 10ms L
//if (bMotorHSpeed) tmp=4;
//else tmp=2;
if (!bPWMK)
{
if (ucPWMZKCnt++==1)
{
ucPWMZKCnt=0;
bPWMK=1;
}
PWMOut=1;
}
else
{
if (ucPWMZKCnt++==2)
{
ucPWMZKCnt=0;
bPWMK=0;
}
PWMOut=0;
}
}
//judge_key();
//PaintDegree(i);
//if (i++==23) i=0;
//DelaySecond(10);
}
}
void inputdeal(void)
{
if (!bInputChange) return;
bInputChange=0;
switch (ucInputValue)
{
case 0x01:
//printf("%bu,%bu,%bu\n",ucInputParam0,ucInputParam1,ucInputParam2);
PaintDegree(ucInputParam0,0);
break;
default:
break;
}
}
void DelaySecond(uchar i)
{
int k;
k=i*10000;
while(k--);
}
void time0_interrupt(void)interrupt 1
{
uchar tmp;
//TH0 = 0x3c;
//TL0 = 0xb0;
TH0=0XD8;
TL0=0XF0;
time0_count++;
ucSig10ms++;
if(time0_count==5)
{
//printf("hello");
time0_count=0;
tmp = readadc();
if (ucLastADValue!=tmp)
{
ucLastADValue=tmp;
ucInputParam0=ucLastADValue/12;
//ucInputParam0 = tmp/100;
//ucInputParam1 = (tmp%100)/10;
//ucInputParam2 = (tmp%100)%10;
bInputChange=1;
ucInputValue=0x01;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -