- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I need to develop a linux application using 7 segments display of stratixII board. How this can be done ? Thanks in advanceLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Microtronix provides an example in their uclinux porting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe you could tell us where to find that example. I would be very interested too and haven't managed to find any examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The software example/template "count binary", which ships with the Nios II IDE, also has some 7 segment display stuff. You'll have better luck using the style of coding in the examples shipped with the IDE.
Cheers, - slacker
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page