#include <STC15.H>
#include <intrins.h>
#define MAIN_Fosc 11059200
#define DataPort P0
#define uint unsigned int
#define uchar unsigned char
bit flag1,flag2;
void GPIO_Init(void);
void INT_Init();
void delay_ms(uchar z);
void float_rr();
void float_r1();
uchar i;
void main()
{
GPIO_Init();
INT_Init();
while(1)
{
if(flag1==1)
float_rr();
if(flag2==1)
float_r1();
}
}
void GPIO_Init()
{
P0M0=0X00;
P0M1=0X00;
P1M0=0X00;
P1M1=0X00;
P2M0=0X00;
P2M1=0X00;
P3M0=0X00;
P3M1=0X00;
P4M0=0X00;
P4M1=0X00;
P5M0=0X00;
P5M1=0X00;
}
void delay_ms(unsigned char z)
{
unsigned int i;
do
{
i=MAIN_Fosc/13000;
while(i--);
}while(z--);
}
void INT_Init()
{
IT0=1;
IT1=0;
EX0=1;
EX1=1;
EA=1;
}
void float_rr()
{
P0=0X7F;
for(i=0;i<8;i++)
{
delay_ms(200);
P0=_cror_(P0,1);
}
}
void float_r1()
{
P0=0XFE;
for(i=0;i<8;i++)
{
delay_ms(200);
P0=_crol_(P0,1);
}
}
void INT0_ISR() interrupt 0 using 0
{
flag1=1;
flag2=0;
}
void INT1_ISR() interrupt 2 using 1
{
flag1=0;
flag2=1;
}
|