Page | 89
int main(int argc, char *argv[])
{
int f_led1, f_led2, f_led3;
unsigned char i = 0;
unsigned char dat1, dat2, dat3;
if((f_led1 = open(LED1, O_RDWR)) < 0){
printf(“error in open %s”,LED1);
return -1;
}
if((f_led2 = open(LED2, O_RDWR)) < 0){
printf(“error in open %s”,LED2);
return -1;
}
if((f_led3 = open(LED3, O_RDWR)) < 0){
printf(“error in open %s”,LED3);
return -1;
}
for(;;){
i++;
dat1 = i&0x1 ? ‘1’:’0’;
dat2 = (i&0x2)>>1 ? ‘1’:’0’;
dat3 = (i&0x4)>>2 ? ‘1’:’0’;
write(f_led1, &dat1, sizeof(dat1));
write(f_led2, &dat2, sizeof(dat2));
write(f_led3, &dat3, sizeof(dat3));
usleep(300000);
}
}
2.
Execute the following instruction in an Ubuntu Linux system to
implement cross compilation;
arm-none-linux-gnueabi-gcc led_acc.c -o led_acc
3.
Download the compiled files to the SBC8140 and enter the
directory where the file led_acc is saved, then execute the
following instruction to run the LED application;
./led_acc &
Summary of Contents for SBC8140
Page 1: ...SBC8140 Single Board Computer User Manual Version 1 1 22nd Jan 2014...
Page 12: ...Page 6 1 4 Interfaces on the SBC8140 Figure 4 SBC8140 Interfaces...
Page 13: ...Page 7 1 5 System Block Diagram Figure 5 SBC8140 system block diagram...
Page 15: ...Page 9 1 6 2 Expansion Board Figure 8 Expansion board dimensions...
Page 128: ...Page 122...
Page 131: ...Page 125...
Page 139: ...Page 133 Appendix 5 FAQ Please visit http www elinux org SBC8600_FAQ...