对应管脚推挽输出,控制一节led亮起来,其他管脚设置为输入高阻太,每次显示一节,都要在前面加上6pin输出为0,防止所有节亮度不一致
switch_pin_in_or_out(1, 0);
switch_pin_in_or_out(2, 0);
switch_pin_in_or_out(3, 0);
switch_pin_in_or_out(4, 0);
switch_pin_in_or_out(5, 1);
switch_pin_in_or_out(6, 1);
void INT0_Rpt() interrupt INT0_VECTOR
{
PINTF0 &= ~0x01; // 清除INT0中断标志位
// if (s2 && !P0_1)
// {
// add_del = 2;
// s1 = 0;
// s2 = 0;
// }
// else if (P0_1)
// {
// s1 = 1;
// }
if(s2 && (P0_0 == P0_1))
{
add_del=2;
s1=0;
s2=0;
}
else
{
s1=1;
s2=0;
}
}
void INT1_Rpt() interrupt INT1_VECTOR
{
PINTF0 &= ~0x02; // 清除INT1中断标志位
// if (s1 && !P0_0)
// {
// add_del = 1;
// s1 = 0;
// s2 = 0;
// }
// else if (P0_0)
// {
// s2 = 1;
// }
if(s1 && (P0_0 == P0_1))
{
add_del=1;
s1=0;
s2=0;
}
else
{
s1=0;
s2=1;
}
}


被折叠的 条评论
为什么被折叠?



