升压板源码很简单:
#include <reg51.h>
#include <intrins.h>
#include <stdio.h>
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef bit BOOL;
sfr P3M1 = 0xb1;
sfr P3M0 = 0xb2;
sbit K1 = P3^2;
sbit K2 = P3^3;
sbit LED = P3^4;
sbit bWorking = P3^5;
WORD count = 0;
void Delay() //@11.0592MHz 25us
{
unsigned char i;
i = 66;
while (--i);
}
void Delay50ms() //@11.0592MHz
{
unsigned char i, j, k;
i = 3;
j = 26;
k = 223;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
main()
{
int i;
P3M1 = 0x20; //#XX100000B
P3M0 = 0x1f; //#XX011111B
K1 = 1;
K2 = 0;
LED = 1;
bWorking = 0;
if ( !bWorking ){
for(i=0;i<3;i++){
Delay50ms();
LED = 0;
Delay50ms();
LED = 1;
}
}
while(1){
if ( bWorking ){
LED = 0;
K1 = 0;
Delay();
K1 = 1;
K2 = 1;
Delay();
K2 = 0;
}
else{
K1 = 1;
K2 = 0;
LED = 1;
Delay();
}
}
}