Swordfish Module - BigDigit.bas

Group

BigDigit.bas displays large digits and other characters on a 4-line character LCD.  Two different fonts and two different character widths are available.

DiskIcon Download: BigDigit.bas

 

Module Options

#option BigDigit_LCDColumns

The number of columns on the LCD display being used.  Default value 20.

#option BigDigit_DigitWidth 

Width of digits in LCD columns.  Valid values are 3 or 4.  Default value 4.  See image below for an example of each digit width.

#option BigDigit_Font

Which font to use.  Valid values are 0 or 1. Default value 0.  See image below for an example of each font.

All Supported Characters in Each Font and Digit Width

Subroutines

compound sub Write (WriteItem)

  • WriteItem - a string, char, byte, word, shortint or integer

Writes a string, char, byte, word, shortint or integer to the LCD display at the current column location.  Column is a private variable used by the module to keep track of where the next digit should be written.  It is incremented by the width of the digit + 1 each time a digit is written to the LCD.  When column is greater than the width of the LCD, it resets to 1.

When WriteItem is a byte, word, shortint or integer value, the value is converted to decimal and written to the LCD (including a leading “-“ if the value is negative).

When WriteItem is a string or char, each supported character in the string is written to the LCD in turn.  Supported characters are the digits 0-9, “.”, “:”, “v”, “a”, “ “ [space], and “o” [writes a ° (degree symbol)].  Any unsupported characters in the string are ignored.


compound sub WriteAt (pColumn, WriteItem)

  • pColumn - the LCD column to start the write at
  • WriteItem - a string, char, byte, word, shortint or integer

Writes a string, char, byte, word, shortint or integer to the LCD display starting at the LCD column, pColumn..

When WriteItem is a byte, word, shortint or integer value, the value is converted to decimal and written to the LCD (including a leading “-“ if the value is negative).

When WriteItem is a string or char, each supported character in the string is written to the LCD in turn.  Supported characters are the digits 0-9, “.”, “:”, “v”, “a”, “ “ [space], and “o” [writes a ° (degree symbol)].  Any unsupported characters in the string are ignored.


 

Example Code

Example Swordfish Code
'---Options
#option BigDigit_DigitWidth = 3
#option BigDigit_Font = 1
#option BigDigit_LCDColumns = 20
 
'---Includes
Include "LCD.bas"
Include "BigDigit.bas"
Include "Convert.bas"
 
 
Dim Hours As Byte
Dim Minutes As Byte
 
Dim Temperature As ShortInt
 
Dim CurrentInt As Byte
Dim CurrentFrac As Byte
 
Dim Volts As Float
 
 
Hours = 12
Minutes = 45
Temperature = -12
CurrentInt = 3
CurrentFrac = 5
Volts = -7.4 
 
While True
 
    LCD.Cls
 
    BigDigit.WriteAt(3, Hours, ":", Minutes)
 
    DelayMS(2000)
 
    LCD.Cls
    BigDigit.WriteAt(6, Temperature, "o")
 
    DelayMS(2000)
 
    LCD.Cls
    BigDigit.WriteAt(9, CurrentInt, ".", CurrentFrac, "a")
 
    DelayMS(2000)
 
    LCD.Cls
    BigDigit.WriteAt(5, FloatToStr(Volts, 1),"v")
 
    DelayMS(2000)
 
Wend

This video shows the example code in action:

Share this article