embedded-software
reusable software modules for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Seven Seg Module

The Seven Seg Module allows for values to be displayed on a seven segment display. More...

Functions

void SevenSeg_Init (void)
 Initialize the Seven Seg Module. More...
 
void SevenSeg_DisplayHex (uint16_t value)
 Displays value on seven seg in Hex. More...
 
void SevenSeg_DisplayRaw (uint8_t seg0, uint8_t seg1, uint8_t seg2, uint8_t seg3)
 Displays individual parameters on up to four seven segment displays. More...
 
void SevenSeg_DisplayFloat (float value)
 Displays float value on seven seg in decimal. More...
 
uint16_t SevenSeg_BCD (uint16_t value)
 Converts binary number (uint16_t) to BCD format. More...
 
void UpdateDisplay (void)
 updates static variables and displays on hex task-compatible function void function to easily display values on display using scheduled tasks Calls hal_Display to display current value of static variables More...
 

Detailed Description

The Seven Seg Module allows for values to be displayed on a seven segment display.

What Module Does: This module provides functions to populate up to four seven segment displays. Available functions allow for four displays to be populated based on a singular 16-bit uint16_t input as well as 4 individual 8-bit uint8_t inputs.

How To Use Module: Call SevenSeg_Init() to initialize the module. Once initialized, calling SevenSeg_DisplayHex(), SevenSeg_DisplayRaw() or SevenSeg_DisplayFloat() will populate four seven segment displays based on the function inputs. These functions will only be run once, flashing the input on the display. To make a persistently readable number, run function in a while loop. Alternatively, if you run UpdateDisplay as a scheduled task, the displays will be constantly populated, and the inputs can be changed using any of the other functions.

//code initializes Seven Seg Module and prints number 8569 in Hex and decimal
uint16_t value = 8569;
//displays 2179 on seven seg display (8569 in HEX)
//displays 8569 on seven seg display
SevenSeg_DisplayRaw(8, 5, 6, 9);
//displays 79.45 on seven seg display
float value2 = 79.45;
SevenSeg_DisplayFloat(float value2);
//code to schedule 12.34 to be displayed every 10 ticks
void example(void)
{
}
Task_Schedule(example, 0, 0, 10);
while(1)
{
}
Author
: Michael Sorce
: Alex Marino
: Michael Maloney
: David Gaffney
Version
0.1

Function Documentation

uint16_t SevenSeg_BCD ( uint16_t  value)

Converts binary number (uint16_t) to BCD format.

Converts unint16_t input from its binary encoding to BCD format

Parameters
valuebinary input that will be converted to BCD format (BCD - Binary Coded Decimal)

Here is the caller graph for this function:

void SevenSeg_DisplayFloat ( float  value)

Displays float value on seven seg in decimal.

This function will convert a 32-bit float input into a 4 digit decimal number from 0000 to 9999. This number will then be displayed on up to four seven segment displays. Max decimal input: 9999 Will take the most significant 4 digits i.e. 9998.5 will display 9998, 85.123 will display 85.12

Warning
DOES NOT ROUND
Parameters
valuefloat that will be displayed in up to 4 seven segment display in decimal

Here is the call graph for this function:

void SevenSeg_DisplayHex ( uint16_t  value)

Displays value on seven seg in Hex.

This function will convert a 16-bit input into a 4 digit HEX number from 0000 to FFFF. This number will then be displayed on up to four seven segment displays. Max decimal input: 65535

Parameters
valuenumber that will be displayed in up to 4 seven segment display in HEX

Here is the call graph for this function:

void SevenSeg_DisplayRaw ( uint8_t  seg0,
uint8_t  seg1,
uint8_t  seg2,
uint8_t  seg3 
)

Displays individual parameters on up to four seven segment displays.

This function will take four uint8_t values and display them across four respective seven segment displays. Currently only supports whole numbers 0 to F as parameters.

Parameters
seg0number to be displayed in the left most display
seg1number to be displayed in the second display from the left
seg2number to be displayed in the third display from the left
seg3number to be displayed in the right most display
//will display as "1582" on seven segment display
SevenSeg_DisplayRaw(1, 5, 8, 2);

Here is the call graph for this function:

void SevenSeg_Init ( void  )

Initialize the Seven Seg Module.

Initializes the seven segment module for operation. Calls hal_seven_seg_Init() which can be found in the hal_seven_seg.c file for the respective MCU being used. Initializes all display values to 0s.

Here is the call graph for this function:

void UpdateDisplay ( void  )

updates static variables and displays on hex task-compatible function void function to easily display values on display using scheduled tasks Calls hal_Display to display current value of static variables

Here is the call graph for this function: