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++

7 segments display

Altera_Forum
Honored Contributor II
1,679 Views

Hi all, 

I need to develop a linux application using 7 segments display of stratixII board. 

How this can be done ? 

Thanks in advance
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
251 Views

Microtronix provides an example in their uclinux porting.

0 Kudos
Altera_Forum
Honored Contributor II
251 Views

Maybe you could tell us where to find that example. I would be very interested too and haven't managed to find any examples.

0 Kudos
Altera_Forum
Honored Contributor II
251 Views

Finally got this working. This example controls leds and 7-segment display. Tested with Nios II Development Kit, Cyclone II Edition. Disable processor type and features -> enable leds, seven segment display from kernel configuration to disable default blinking code. 

 

#include <errno.h># include <stdio.h> # include "nios2_system.h" void nr_pio_showhex(int value) {  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  };  int led_value;  // Left Hand Digit, goes to PIO bits 8-14  led_value = _hex_digits_data;  led_value |= (_hex_digits_data) << 8;  na_seven_seg_pio->np_piodata = led_value; } int main (int argc, char* argv) {  int i;  long x;  np_pio *led;  //np_pio *seven_seg;    led = na_led_pio;  //seven_seg = na_seven_seg_pio;    while(1) {    led->np_piodata = i;    //seven_seg->np_piodata = i;    nr_pio_showhex(i);    i++;    for(x=0; x<655350; x++);  }    return 0; } 

 

Found example of interacting with hardware from http://www.niosforum.com/forum/index.php?a...t=st&f=18&t=710 (http://www.niosforum.com/forum/index.php?act=st&f=18&t=710)here (http://www.niosforum.com/forum/index.php?act=st&f=18&t=710). PIO structure is in C:\altera\kits\nios2\bin\eclipse\plugins\com.microtronix.nios2linux.kernel_1.4.0\linux-2.6.x\include\asm-nios2nommu\pio_struct.h. Copied 7-segment code from C:\altera\kits\nios2\components\altera_avalon_pio\sdk\lib\pio_showhex.c.
0 Kudos
Altera_Forum
Honored Contributor II
251 Views

The software example/template "count binary", which ships with the Nios II IDE, also has some 7 segment display stuff. You&#39;ll have better luck using the style of coding in the examples shipped with the IDE. 

 

Cheers, 

 

- slacker
0 Kudos
Reply