Digital Scale  1.0
Digital Scale
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Functions | Variables
display.c File Reference

Handles the 7-Segment Display. More...

Functions

void Int16toDisplayHex (uint16_t i, volatile uint8_t *p)
 Writes 4 Digits to the Display RAM. More...
 
void Int24toDisplayHex (uint32_t l, volatile uint8_t *p)
 Writes 6 Digits to the Display RAM. More...
 
void Int8toDisplayHex (uint8_t b, volatile uint8_t *p)
 Writes 2 Hex-Digits to the Display RAM. More...
 
void NextDigit (void)
 Advances to the next Digit. More...
 
void SetDisplayAltLoBat (void)
 Sets the alternate display to LoBat. More...
 
void SetDisplayAltUncal (void)
 Sets the alternate display to unCal. More...
 
void SetDisplayAuto0 (volatile uint8_t *adr)
 Sets the display to Auto-0. More...
 
void SetDisplayCAL (void)
 Sets the display to CAL (Calibration) More...
 
void SetDisplayCLR (volatile uint8_t *adr)
 Clears the Display. More...
 
void SetDisplayDefCon (void)
 Sets the display to dEFCon (default config) More...
 
void SetDisplayDontTouch (void)
 Sets the display to don't touch ("-touch") More...
 
void SetDisplayHiRes (void)
 Sets the display to HI (High Resolution) for two seconds. More...
 
void SetDisplayLoRes (void)
 Sets the display to LO (Low Resolution) for two seconds. More...
 
void SetDisplayRef (void)
 Sets the display to rEF. More...
 

Variables

const uint8_t chars []
 The Character to 7-Segment mapping. More...
 
volatile uint8_t display [7]
 Display RAM for normal Display display[0] is left. More...
 
volatile uint8_t display_alt [7]
 Display RAM for alternate Display display_alt[5] is right. More...
 
volatile uint8_t displayBlinkMask
 Sets Display Blink Mode. More...
 
volatile uint8_t displayBrightness
 The current Display Brightness. More...
 
volatile DISPLAY_MODE_t displayMode
 Selects the Display Mode. More...
 
bool lzb
 Controlls Leading Zero Blanking. More...
 

Detailed Description

Handles the 7-Segment Display.

Function Documentation

void NextDigit ( void  )

Advances to the next Digit.

This is done every ms. Since we have 6 digits the display refresh rate is 166.7Hz. This is fairly high but if dimming is used it reduces to 41 Hz allowing 3 different brightnesses plus off.

void Int8toDisplayHex ( uint8_t  b,
volatile uint8_t *  p 
)

Writes 2 Hex-Digits to the Display RAM.

Parameters
bThe Byte
pThe address inside the Display RAM

The second digit is only displayed if it's address is not display[7] or display_alt[6]. This allows the display to be shiftet right by one to make room for a '-' sign.

void Int16toDisplayHex ( uint16_t  i,
volatile uint8_t *  p 
)

Writes 4 Digits to the Display RAM.

Parameters
iThe Uint16 (packed BCD or packed HEX)
pThe address inside the Display RAM
void Int24toDisplayHex ( uint32_t  l,
volatile uint8_t *  p 
)

Writes 6 Digits to the Display RAM.

Parameters
lThe Uint32 (packed BCD or packed HEX)
pThe address inside the Display RAM
Note
The MSB of l is ignored.
void SetDisplayCLR ( volatile uint8_t *  adr)

Clears the Display.

Parameters
adrThe Display Memory. May be display or display_alt.
void SetDisplayAuto0 ( volatile uint8_t *  adr)

Sets the display to Auto-0.

Parameters
adrThe Display Memory. May be display or display_alt.

Writes "Auto-0" to the selected display RAM

void SetDisplayDontTouch ( void  )

Sets the display to don't touch ("-touch")

This is used during calibration while averaging the zero weight or reference weight which each take about 13s. Display mode is set to normal by this function.

void SetDisplayRef ( void  )

Sets the display to rEF.

This is used during calibration to request a reference weight. Display mode is set to normal by this function.

void SetDisplayAltLoBat ( void  )

Sets the alternate display to LoBat.

This is always done in alternate display mode so display mode is set to alternate by this function.

void SetDisplayAltUncal ( void  )

Sets the alternate display to unCal.

This is always done before entering the main loop if ERR_UNCAL is set in eFlags

void SetDisplayDefCon ( void  )

Sets the display to dEFCon (default config)

This is used during calibration to request a reference weight. Display mode is set to normal by this function.

void SetDisplayCAL ( void  )

Sets the display to CAL (Calibration)

This is used during calibration to indicate The beginning of the procedure Display mode is set to normal by this function.

void SetDisplayHiRes ( void  )

Sets the display to HI (High Resolution) for two seconds.

A double click is used to change between fast (low resolution) and precision (high resolution, but slow). This routine is used to indicate high resolution mode. It includes a delay for two seconds.

Note
Display is set to normal mode.
void SetDisplayLoRes ( void  )

Sets the display to LO (Low Resolution) for two seconds.

A double click is used to change between fast (low resolution) and precision (high resolution, but slow). This routine is used to indicate low resolution (fast) mode. It includes a delay for two seconds.

Note
Display is set to normal mode.

Variable Documentation

volatile uint8_t display[7]

Display RAM for normal Display display[0] is left.

Note
This is one byte larger than the display. Negative values will be posted to display[1] instead of display[0] with display[0] set to DISPLAY_MINUS so we need one digit more!
volatile uint8_t display_alt[7]

Display RAM for alternate Display display_alt[5] is right.

volatile uint8_t displayBrightness

The current Display Brightness.

Values from 0 to 3 are allowed. 0=display off, 3=full brightness

bool lzb

Controlls Leading Zero Blanking.

Set to TRUE before you display a Number with leading zero blanking.

const uint8_t chars[]

The Character to 7-Segment mapping.

Bit 0 = Segment A
...
Bit 6 = Segment G
Bit 7 = DP
Set display[] to any of this values or use custom characters.