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

Go to the source code of this file.

Macros

#define BLINK_ALT   4
 The alternate display blinks. More...
 
#define BLINK_FAST   2
 The normal display blinks fast (1hz) More...
 
#define BLINK_SLOW   1
 The normal display blinks slowly (0.5hz) More...
 

Enumerations

enum  DISPLAY_MODE_t { DISPLAY_NORMAL, DISPLAY_ALT_SHOW_NORMAL, DISPLAY_ALT_SHOW_ALT }
 

Functions

static void DisplayAlt (void)
 Sets the Display to alternate Mode. More...
 
static void DisplayNormal (void)
 Sets the Display to normal Mode. More...
 
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...
 
void SetDisplayRESET (volatile uint8_t *adr)
 

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...
 
static const uint8_t DISPLAY_APOSTROPHE =0x1b
 
static const uint8_t DISPLAY_c =0x19
 
static const uint8_t DISPLAY_DEGREE =0x15
 
static const uint8_t DISPLAY_h =0x1a
 
static const uint8_t DISPLAY_H =0x1c
 
static const uint8_t DISPLAY_L =0x10
 
static const uint8_t DISPLAY_MINUS =0x14
 
static const uint8_t DISPLAY_n =0x11
 
static const uint8_t DISPLAY_o =0x18
 
static const uint8_t DISPLAY_r =0x12
 
static const uint8_t DISPLAY_SPACE =0x16
 
static const uint8_t DISPLAY_t =0x13
 
static const uint8_t DISPLAY_u =0x17
 
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...
 

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 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 SetDisplayRESET ( volatile uint8_t *  adr)
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 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.
static void DisplayNormal ( void  )
inlinestatic

Sets the Display to normal Mode.

Only display[] is displayed then.

static void DisplayAlt ( void  )
inlinestatic

Sets the Display to alternate Mode.

display[] is displayed for three seconds, then display_alt[] is displayed for one second. display_alt[] normally contains some error message (like "Low Bat" etc).

Variable Documentation

volatile uint8_t displayBrightness

The current Display Brightness.

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

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.

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.

const uint8_t DISPLAY_L =0x10
static
const uint8_t DISPLAY_n =0x11
static
const uint8_t DISPLAY_r =0x12
static
const uint8_t DISPLAY_t =0x13
static
const uint8_t DISPLAY_MINUS =0x14
static
const uint8_t DISPLAY_DEGREE =0x15
static
const uint8_t DISPLAY_SPACE =0x16
static
const uint8_t DISPLAY_u =0x17
static
const uint8_t DISPLAY_o =0x18
static
const uint8_t DISPLAY_c =0x19
static
const uint8_t DISPLAY_h =0x1a
static
const uint8_t DISPLAY_APOSTROPHE =0x1b
static
const uint8_t DISPLAY_H =0x1c
static