pleaaaase help me
I try to simplify my code just for seven segment but nothing happen in my board .
this is my code :
# include "count_binary.h"
/* Seven Segment Display PIO Functions
* sevenseg_set_hex() -- implements a hex digit map.
*/
# ifdef SEVEN_SEG_PIO_BASE
static void sevenseg_set_hex(int hex)
{
static alt_u8 segments[16] = {
0x81, 0xCF, 0x92, 0x86, 0xCC, 0xA4, 0xA0, 0x8F, 0x80, 0x84, /* 0-9 */
0x88, 0xE0, 0xF2, 0xC2, 0xB0, 0xB8 }; /* a-f */
unsigned int data = segments[hex & 15] | (segments[(hex >> 4) & 15] << 8);
IOWR_ALTERA_AVALON_PIO_DATA(SEVEN_SEG_PIO_BASE, data);
}
# endif
/* static void count_sevenseg()
*
* Display value of 'count' on the Seven Segment Display
*/
static void count_sevenseg()
{
# ifdef SEVEN_SEG_PIO_BASE
sevenseg_set_hex(count);
# endif
}
int main(void){
int __attribute__ ((unused)) wait_time; /* Attribute suppresses "var set but not used" warning. */
int count = 0;
/* Continue 0-ff counting loop. */
while( 1 )
{
usleep(100000);
count_sevenseg();
/*
* If done counting, wait about 7 seconds...
* detect button presses while waiting.
*/
if( count == 0xff )
{
printf("\nWaiting...");
usleep(100000); /* Sleep for 0.1s. */
}
}
count++;
return 0 ;
}