#include <stdio.h>
#include <absacc.h>
#include <reg52.h>
#include <math.h>
#define uchar unsigned char
#define uint unsigned int
//*?????
sbit E0=P3^0; //*??P3.0,?EPWM??????
sbit L0=P2^4;
sbit K2=P2^2;
sbit K1=P2^1;
sbit K0=P2^0;
//*????????"0"-"5"
uchar code a[6]={0x11,0x12,0x13,0x14,0x15,0x16};
//*IPWM????
uchar code b[6]={0x0c,0x19,0xab,0x32,0x3f,0x4f};
uchar time;
uchar period[6]={6000,5938,5875,5813,5750,5688};
uchar high[6]={250,312,375,437,500,562};
int i;
timer0 () interrupt 1 using 1
{
TH0=(65536-6250)/256;
TL0=(65536-6250)%256;
if (++time==high[i])E0=0;
else if(time==period[i])
{time=0;
E0=1;
}
}
//*?????
void delay(void)
{
int j;
for(j=300;j>0;j--);
}
main()
{
TMOD=0X01;
TH0=(65536-6250)/256;
TL0=(65536-6250)%256;
EA=1;
ET0=1;
TR0=1;
i=5;
E0=1; //* ?????
K0=1;
K1=1;
K2=0;
P0=0;
P1=0x10;
delay();
if ((K1==0)&&(K2==1))
{i++;
time=period[i];time++;
time=high[i];
P0= b[i];
P1= a[i]; }
else if ((K2==0)&&(K1==1))
{
i--;
time=period[i]; time++;
time=high[i];
P0= b[i];
P1= a[i];
}
if ((K1==0)&&(i<=0))
{ i=0;
time=period[i];time++;
time=high[i];
P0= b[i];
P1= a[i];
}
if ((K2==0)&&(i>=5))
{
i=5;
time=period[i];time++;
time=high[i];
P0= b[i];
P1= a[i];
}
}
i=1 wu cuo
i=2 /*** error 65: access violation at C:0x0100 : no 'execute/read' permission
i=3 /*** error 65: access violation at C:0x0200 : no 'execute/read' permission
i=4 /*** error 65: access violation at C:0x0200 : no 'execute/read' permission
i=5 /*** error 65: access violation at C:0x0400 : no 'execute/read' permission
i=6 /*** error 65: access violation at C:0x0500 : no 'execute/read' permission
| 歡迎光臨 (http://m.raoushi.com/bbs/) | Powered by Discuz! X3.1 |