Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

7 segment display showing wrong values

Altera_Forum
Honored Contributor II
963 Views

np_pio *ssd = (np_pio *)na_SEG7_Display; static unsigned char _hex_digits_data = {     0x01, 0x4f, 0x12, 0x06, 0x4c, 0x24, 0x20, 0x0f, 0x00, 0x04, // 0-9     0x08, 0x60, 0x72, 0x42, 0x30, 0x38                      // a-f }; void main(void) {     long x;     np_pio *led;     led = na_led_red;     led->np_piodata = 11;     nr_pio_showhex(11); } void nr_pio_showhex(int value) {     int led_value;     led_value = _hex_digits_data;     led_value |= (_hex_digits_data) << 8;     ssd->np_piodata = led_value; } 

 

when i run the above code in uclinux on DE2, the 7 seg display show 160. 

when i change the value to 10 instead of 11, it shows 108. 

 

den i remove the line &#39;led_value |= (_hex_digits_data[(value >> 4) & 0xF]) << 8;&#39; n change the value to 10, it print 60. 

 

anyone has any idea wat&#39;s wrong? pls advise. thx.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
237 Views

Problem solved.

0 Kudos
Reply