https://static.assets-stash.eet-china.com/album/old-resources/2009/1/29/c9dd719b-4afc-4e9a-ae63-17ff2386f5ab.rar" target=_blank> 0x90, //10010000b, c=out b="out" a="in"
0x82, //10000010b, c=out b="in" a="out"
0x92, //10010010b, c=out b="in" a="in"
0x89, //10001001b, c=in b="out" a="out"
0x99, //10011001b, c=in b="out" a="in"
0x8B, //10001011b, c=in b="in" a="out"
0x9B, //10011011b, c=in b="in" a="in"
};
/*--------------------------------------------------------------*/
//设置工作方式
/*
void SetMode(unsigned char mode)
{
CWR = mode;
}
*/
/*--------------------------------------------------------------*/
//复位CWR
void ResetMode(void)
{
CWR = 0x00;
}
/*--------------------------------------------------------------*/
//指定端口写入数据
/*
void WR_8255(unsigned char add, unsigned char dat)
{
if(add == 0) PortA = dat;
else if(add == 1) PortB = dat;
else PortC = dat;
}
*/
/*--------------------------------------------------------------*/
//指定端口读出数据
/*
unsigned char RD_8255(unsigned char add)
{
unsigned char dat;
if(add == 0) dat = PortA;
else if(add == 1) dat = PortB;
else dat = PortC;
return(dat);
}
*/
/*--------------------------------------------------------------*/
//函数运用演示1
/*
//延时500000+0us 函数定义
void delay500ms(void)
{
unsigned char i,j,k;
for(i=205;i>0;i--)
for(j=116;j>0;j--)
for(k=9;k>0;k--);
}
void main(void)
{
SetMode(mode_8255[0]);
while(1)
{
WR_8255(0, 0xff);
delay500ms();
WR_8255(0, 0x00);
delay500ms();
}
}
*/
/*--------------------------------------------------------------*/
//函数运用演示2
/*
void main(void)
{
unsigned char k = 0x01;
unsigned char i;
CWR = mode_8255[0];
while(1)
{
PortA = k;
delay500ms();
k <<= 1; i++;
if(i == 8) {k = 0x01; i = 0;}
}
}
*/
#endif
文章评论(0条评论)
登录后参与讨论