Count Binary

Count Binary is a simple program that, using an 8-bit variable, repeatedly counts from 0 to FF. The output of this variable is displayed on the LEDs, the seven-segment display, and the LCD. The four buttons (SW0-SW3) control output to these devices in the following manner:

  • Button1 (SW0): LED is "counting"
  • Button2 (SW1): Seven segment is "counting"
  • Button3 (SW2): LCD is "counting"
  • Button4 (SW3): All of the peripherals are "counting"

Upon completion of "counting," there is a short waiting period during which button/switch presses are identified on STDOUT.

Note: These buttons have not been de-bounced, so one button press may cause multiple notifications to STDOUT.

Using This Design Example

To obtain this design example, download a free evaluation version of the Nios® II Embedded Design Suite (EDS). This embedded software example is installed with the Nios II EDS in the <Nios II EDS installation path>/examples/software directory and is available as a Nios II integrated development environment (IDE) project template. The template includes the project settings required to run this design on the supported target hardware configurations. To use this software example, simply create a new C/C++ application project in the IDE and choose the desired project template.

The use of this design is governed by, and subject to, the terms and conditions of the Intel Design Example License Agreement.

Hardware Requirements

This example requires the following devices to be present in the target hardware design:

  • LED programmable I/O (PIO) named led_pio
  • Seven-segment display PIO named seven_seg_pio
  • LCD display named lcd_display
  • Button PIO named button_pio
  • UART Joint Test Action Group (JTAG) or standard serial

You can run this software design example on the following Nios II hardware design examples:

Stratix® and Stratix II Design Examples

  • Standard
  • Full-featured

Cyclone® Design Examples

  • Standard
  • Full-featured

Related Links

For more information about using this example in your project, go to:

Design Examples Disclaimer

These design examples may only be used within Intel® Corporation devices and remain the property of Intel. They are being provided on an “as-is” basis and as an accommodation; therefore, all warranties, representations, or guarantees of any kind (whether express, implied, or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Intel expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Intel.