这是用c语言编写的
#include <intrins.h>
#include <stdio.h>
#include <math.h>
#include "UPSD3200.H"
#include "upsd_pwm.h"
#define uint unsigned int
#define uchar unsigned char
PSD_REGS PSD8xx_reg _at_ csiop;
#define KEYIO (~(PSD8xx_reg.DATAIN_A)) & 0x07
sbit CP=P4^7;
sbit U_D=P1^1;
void init_system(); // 系统初始化
uchar keyboard();
void uPSD_PWM4_Variable(unsigned char PWM_Period, unsigned char PWM_PulseWidth);
uchar Adjust_station=NO;
unsigned char data x,flag;
unsigned char keyboard() //键盘输入
{
unsigned char a=0xff,b=0x01,c=0xf8,d;//有按键的位置
uint i;
do{
a=KEYIO|c;
}while(a==0xff);
if (a == 0xfe){d = '1';}
else if (a == 0xfd){d = '2';}
else if (a == 0xfb){d = '3';}
else {d = '0';}
return(d);
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载