#include "suryaa.h"
void setup()
{
pin_configure();
}
void loop()
{
volatile char x,a[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
volatile long i,j,count=0;
while(1)
{
x=input();
if((x & 0x01)==0x01 || (x & 0x08)==0x08 || (x & 0x40)==0x40 || (x & 0x80)==0x80)
count=count+1;
else
output(0x00);
if(count==4)
{
//for(j=0;j<1000000;j++);
output(0x80);
for(j=0;j<1000000;j++);
break;
}
else
output(0x00);
}
}
/*void loop() {
volatile char x, a[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
volatile long j, count = 0;
while (1) {
x = input();
count = 0; // Reset count on each iteration
// Count the number of specified switches pressed
for (int i = 0; i < 8; i++) {
if (x & a[i]) {
count++;
}
}
// If exactly 4 specified switches are pressed one by one
if (count == 4) {
for (int i = 0; i < 5; i++) { // Check the sequence
if (!(x & a[i]) || !(x & a[i+1]) || !(x & a[i+2]) || !(x & a[i+3])) {
count = 0; // Reset count if sequence not found
break; // Exit loop if sequence not found
}
}
// If sequence found, turn on LED and break out of loop
if (count == 4) {
output(0x80); // Turn on LED
for (j = 0; j < 1000000; j++); // Delay
break; // Exit loop
}
}
output(0x00); // Turn off LED if condition not met
}
}*/
//#include "suryaa.h"
/*void setup()
{
configure_pin();
}
void loop()
{
volatile long i,j;
volatile char a[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0X6F};
for(i=2;i<10;i++)
{
int y=0;
y=is_prime(i);
if(y==1)
output(a[i]);
for(j=0;j<200000;j++);//delay
}
}
void setup()
{
volatile char *dirf,*dirk;
volatile char *outf,*ink;
volatile long i,j;
dirf=(char*)0x30; //portf direction register
*dirf=0x01; //portf pin configure
outf=(char*)0x31;ink=(char *)0x106; //portf data register.
//*outf=0x01; //portf pin value.
dirk=(char *)0x107; //portk direction register
*dirk=0x00; //portk pin configure
ink=(char *)0x106;//portk input register
//access value in run time of input register.
i=0;
while(1)
{
volatile char x=*ink;
if((x & 0x01)==0x01)
{
i++;
for(j=0;j<50000;j++);
}
if(i%2==1)
*outf=0x01;
else
*outf=0x02;
}
}
void loop()
{
}*/