it took me a long while.. but i have revise my code:
does it look right ? it doesn't look like an interrupt to me
Code:
#include <stdio.h>
#include <stdlib.h>
//#define P0.5 data0
//#define P0.4 data1
//#define P0.3 data2
//#define P0.2 data3
//#define P0.1 data4
//for testing purposes, call interrupt function as 'main' function
int main(void)
{
int cmd; //command identifer
int cmd_num; //command number
int data[4]; //command # sent by primary microcontroller
int i;
//for testing purpose, ask user to input databits manually
printf("data0: ");
scanf("%i",&data[0]);
printf("data1: ");
scanf("%i",&data[1]);
printf("data2: ");
scanf("%i",&data[2]);
printf("data3: ");
scanf("%i",&data[3]);
printf("data4: ");
scanf("%i",&data[4]);
//print the value in the 5 databus
printf("data =");
for(i=0; i<5; i++)
{
printf( "%d",abs(data[4-i]));
}
cmd_num = data[0]*2 + data[1]*4 + data[2]*8 + data[3]*16 + data[4]*32;
printf("\ncmd number= %i",cmd_num);
sleep();
while(1) //check at all time if there's a command call
{
if (cmd_num !=0)
//send(cmd); //return cum_number
for(i=0; i<5; i++)
{
data[i]=0; //reset databus for
}
}
return (0);
}