I wanted to display positive , negative sign and decimal point on the display but also 4 digits but I only have 4 modules? I noticed we had 3 columns of unused leds so why not move the digits to the far right making the first 3 columns free then display them there. I have done just that now the EEPROM has the digits 1 to 9 & 0 at the far right and Sub Disply_num finds these in the string notes the position, removes them from the string then after getting the number pattern from the EEPROM adds them in to the front of the number giving us 4 digits and the special characters.
Below is the EEPROM data and the new sub.
Regards Paul
[code:1:6e46327909]
'--------------------------------
'--this gets the string (text value)
'--of a number finds a decimal point & negative sign & plus sign
'--removes it from the string then
'--displays it where it should be on the
'--display while it gets and displays the 4 digits
'--plus decimal point and or negative sign
'--to do this the numerical characters in EEPROM
'--have been moved 3 dot colums to the right to make
'--space for these special characters
Sub Disply_num
Local X As Byte
Local Y As Byte
Local Z As Byte
Local Dpoint As Byte 'decimal point "."
Local Negtiv As Byte 'negative sign "-"
Local Plus As Byte 'the plus sign "+"
Plus = Charpos(adcprn , "+") 'find the plus sign location
If Plus > 0 Then
Delchar Adcprn , Plus 'get rid of plus sign
End If
Dpoint = Charpos(adcprn , ".") 'find the decimal point location
If Dpoint > 0 Then
Delchar Adcprn , Dpoint 'get rid of decimal point
End If
Negtiv = Charpos(adcprn , "-") 'find the negative sign location
If Negtiv > 0 Then
Delchar Adcprn , Negtiv 'get rid of negative sign
End If
Y = Len(adcprn)
If Y > 4 Then Y = 4 'we can only display 4
For Z = 1 To Y
Kar = Mid(adcprn , Z , 1) 'get character one from the string
Dignum = Z 'display it at digit Z
Call Display_chr
Dig(z) = Ana 'Ana contains the character from eeprom rotated
'ready to display
Next Z
'what we do here is combine a digit with the
'decimal point and or the negative sign
If Plus > 0 Then 'put back plus sign
Dig(plus).17 = 1
Dig(plus).24 = 1
Dig(plus).25 = 1
Dig(plus).26 = 1
Dig(plus).33 = 1
End If
If Dpoint > 0 Then 'put back decimal point
Dig(dpoint).25 = 1
Dig(dpoint).33 = 1
End If
If Negtiv > 0 Then 'put back negative sign
Dig(negtiv).24 = 1
Dig(negtiv).25 = 1
Dig(negtiv).26 = 1
End If
Call Show_text
Waitms 200
End Sub
'--------------------------------------
'--Here we stor text in eeprom to save on flash space
$eeprom 'start of eeprom data
Data 0 , 0 , 0 , 62 , 81 , 73 , 69 , 62 ' 0
Data 0 , 0 , 0 , 0 , 66 , 127 , 64 , 0 ' 1
Data 0 , 0 , 0 , 98 , 81 , 73 , 73 , 70 ' 2
Data 0 , 0 , 0 , 34 , 73 , 73 , 73 , 54 ' 3
Data 0 , 0 , 0 , 24 , 20 , 18 , 127 , 16 ' 4
Data 0 , 0 , 0 , 47 , 73 , 73 , 73 , 49 ' 5
Data 0 , 0 , 0 , 60 , 74 , 73 , 73 , 48 ' 6
Data 0 , 0 , 0 , 1 , 113 , 9 , 5 , 3 ' 7
Data 0 , 0 , 0 , 54 , 73 , 73 , 73 , 54 ' 8
Data 0 , 0 , 0 , 6 , 73 , 73 , 41 , 30 ' 9
Data 7 , 5 , 7 , 0 , 60 , 66 , 66 , 66 ' : DEG C
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ' ;
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ' <
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ' =
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ' >
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ' ?
Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ' @
Data 0 , 126 , 17 , 17 , 17 , 126 , 0 , 0 ' A
Data 0 , 127 , 73 , 73 , 73 , 54 , 0 , 0 ' B
Data 0 , 62 , 65 , 65 , 65 , 34 , 0 , 0 ' C
Data 0 , 127 , 65 , 65 , 65 , 62 , 0 , 0 ' D
Data 0 , 127 , 73 , 73 , 73 , 65 , 0 , 0 ' E
Data 0 , 127 , 9 , 9 , 9 , 1 , 0 , 0 ' F
Data 0 , 62 , 65 , 73 , 73 , 122 , 0 , 0 ' G
Data 0 , 127 , 8 , 8 , 8 , 127 , 0 , 0 ' H
Data 0 , 0 , 65 , 127 , 65 , 0 , 0 , 0 ' I
Data 0 , 48 , 64 , 64 , 64 , 63 , 0 , 0 ' J
Data 0 , 127 , 8 , 20 , 34 , 65 , 0 , 0 ' K
Data 0 , 127 , 64 , 64 , 64 , 64 , 0 , 0 ' L
Data 0 , 127 , 2 , 4 , 2 , 127 , 0 , 0 ' M
Data 0 , 127 , 2 , 4 , 8 , 127 , 0 , 0 ' N
Data 0 , 62 , 65 , 65 , 65 , 62 , 0 , 0 ' O
Data 0 , 127 , 9 , 9 , 9 , 6 , 0 , 0 ' P
Data 0 , 62 , 65 , 81 , 33 , 94 , 0 , 0 ' Q
Data 0 , 127 , 9 , 9 , 25 , 102 , 0 , 0 ' R
Data 0 , 38 , 73 , 73 , 73 , 50 , 0 , 0 ' S
Data 0 , 1 , 1 , 127 , 1 , 1 , 0 , 0 ' T
Data 0 , 63 , 64 , 64 , 64 , 63 , 0 , 0 ' U
Data 0 , 31 , 32 , 64 , 32 , 31 , 0 , 0 ' V
Data 0 , 63 , 64 , 60 , 64 , 63 , 0 , 0 ' W
Data 0 , 99 , 20 , 8 , 20 , 99 , 0 , 0 ' X
Data 0 , 7 , 8 , 112 , 8 , 7 , 0 , 0 ' Y
'data 0 , 113 , 73 , 69 , 67 , 0 , 0 , 0 ' Z
'Data 7 , 5 , 7 , 0 , 60 , 66 , 66 , 66 ' !
'-------------prompts
Data "S" , "U" , "N" , "M" , "O" , "N" , "T" , "U" , "E" , "W" , "E" , "D"
Data "T" , "H" , "R" , "F" , "R" , "I" , "S" , "A" , "T"
Data "T" , "I" , "M" , "E" , "D" , "A" , "T" , "E" , "T" , "E" , "M" , "P"
Data "2"
Data "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9",
Data "A" , "L" , "A" , "M" , "D" , "A" , "Y" ', "M" , "A" , "L" , "A" , "M"
'Data "A" , "L" , "A" , "M"
Data &H23 'this is the register E control byte
'&H23 is the default with alarm off
'&HA3 is alarm on this is the
'eram variable Ereg
Data 2368 , 2386 , 2428 'default values for brightness
'Data 0 , 0 , 0 , 0 , 0 , 0 'default alarm values
$data
[/code:1:6e46327909]
↧