Instant SoC Class Library  3.1
FC_IO_SegmentDisplay Class Reference

Segment Display controller. More...

Inheritance diagram for FC_IO_SegmentDisplay:
FC_Base

Public Member Functions

 FC_IO_SegmentDisplay (U32 numSegments, U32 numMDisplay, U32 select_polarity=1)
 
void SetDisplay (U32 segments, U32 display)
 

Detailed Description

Segment Display controller.

Adds to interface:
<name>_seg : out std_logic_vector(numSegments-1 downto 0) <name>_sel : out std_logic_vector(numDisplay-1 downto 0) where <name> is c++ object name.
Any number of instances are allowed.

// This example shows how to use the FC_IO_UART_RX, FC_IO_UART_TX and FC_IO_SegmentDisplay classes.
// When started the application sends a hello world message on the tx uart.
// When receiving a char the char is scrolled on the the segment display
// The received bytes are sent on tx (echoed).
#include "fc_io.h"
#include "fc_system.h"
U32 ToSeg(char c); // Translates char to active segments
int main()
{
//% hw_begin
FC_IO_Clk clk(100);
FC_IO_UART_RX rx(115200);
FC_IO_UART_TX tx(115200);
//% hw_end
tx << "Hello world!!\r\n";
U32 seg[4] = {0,0,0,0}; // Init all segments
for (;;)
{
if( rx.NumValid() > 0 ) {
char b = rx.GetByte(); // Read one byte
for(int i=3;i>=0;i--) { // Shift the segments
if(i==0)
seg[i] = ToSeg(b);
else
seg[i] = seg[i-1];
sd.SetDisplay( seg[i], i );
}
tx << b; // Echo the received byte
}
}
}
FC_IO_Clk
System clock input.
Definition: fc_io.h:55
FC_IO_UART_TX
UART Transmitter.
Definition: fc_io.h:348
FC_IO_UART_RX
UART Receiver.
Definition: fc_io.h:399
FC_IO_SegmentDisplay
Segment Display controller.
Definition: fc_io.h:688