volatile int *dirD,*dirB,*dirC,*outputD,*inputD,*outputB,*inputB,*outputC,*inputC;
void init_PORTD(unsigned char in_out)
{
inputD=0x29;
outputD=0x2B;
dirD=0x2A;
*dirD=in_out;
}
void init_PORTB(unsigned char in_out)
{
inputB=0x23;
outputB=0x25;
dirB=0x24;
*dirB=in_out;
}
void init_PORTC(unsigned char in_out)
{
inputC=0x26;
outputC=0x28;
dirC=0x27;
*dirC=in_out;
}
void GLOW_LED_5301(void)
{
init_PORTD(0xff);
volatile long i,j;
volatile char LEDs_on[4]={0x20,0x28,0x29,0x31};
for(i=0;i<4;i++)
{
*outputD=LEDs_on[i];
for(j=0;j<600000;j++);
}
*outputD=0x00;
for(j=0;j<10000;j++);
}
void setup() {
volatile unsigned char outputmode=0xff,inputmode1=0x00,inputmode2=0x00;
volatile unsigned char ReadSwitch1,ReadSwitch2;
init_PORTD(outputmode);
init_PORTB(inputmode1);
init_PORTC(inputmode2);
while(1){
*inputB=0x00;
ReadSwitch1=*inputB;
for(int k=0;k<500000;k++);
if((ReadSwitch1 & 0x01)==0x01)
{
Serial.print("vamsi");
GLOW_LED_5301();
}
}
}
void loop() {
}