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.

mt_ignore:AllFonts_copyAll 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:


Posted: 8 years 8 months ago by Anonymous #5468
Anonymous's Avatar
What a great idea Andy. The module looks very easy to adopt into any project that with an LCD.

The font/width selection is a very nice touch
Posted: 8 years 8 months ago by tommytecho #5614
tommytecho's Avatar
would be interested to know how to make line 0 normal size
line 1 and 2 double size line 3 normal size

any help would great

your application is fantastic

regards


tommy
Posted: 8 years 8 months ago by andyo #5615
andyo's Avatar
I had a quick look at doing a font which is only 2 rows high. The problem I ran into is that you can only load 8 custom characters into the LCD - each Digit is made up of a combination of these 8 custom characters. In my first attempts I couldn't come up with 8 characters which would allow me to assemble the digits 0-9 across 2 rows - kept needing 9

Will have another look at it but I'm not sure there's a straightforward solution...
Posted: 8 years 8 months ago by andyo #5623
andyo's Avatar
This is the best I can do within the 8 custom character limit. As you can see, the 2, 3 and 5 aren't great but the other digits aren't too bad. Does this help? Let me know if you need some more details of how the digits are generated.

Cheers,
Posted: 8 years 8 months ago by tommytecho #5630
tommytecho's Avatar
thanks Andy I can see it's a bit of a nightmare to do , many thanks for your efforts
just asking if it was possible , maybe I will continue with GLCD cost more but
gives good results

regards

chris
Posted: 7 years 11 months ago by mast #9087
mast's Avatar
Hi,

I can't download BigDigit.bas. error 404
Posted: 7 years 11 months ago by octal #9090
octal's Avatar
In fact most of the links does not work as expected since the update of the site.
Each time you click on a link you got a message (404) Bad Karma ...
seems links have to be fixed for all SF modules !!!
Posted: 7 years 11 months ago by Graham Mitchell #9091
Graham Mitchell's Avatar
Sorry! Until all URLs are sorted, the files can be accessed directly via DOCman http://digital-diy.com/index.php?option ... Itemid=183
Posted: 7 years 2 months ago by Ph1lj #11094
Ph1lj's Avatar
This is the best I can do within the 8 custom character limit. As you can see, the 2, 3 and 5 aren't great but the other digits aren't too bad. Does this help? Let me know if you need some more details of how the digits are generated.



Hi Andy

This looks really handy, could you please provide me with a copy of the two line version.

here's hoping

Forum Activity

Member Access