Help with the new TASK function
John Bond
Posts: 369
HELP!!!
I’m building a component feeder using a SX48 and a LCD 20X4 serial display. The device uses a clock so I decided to use Jon’s Nuts and Volts code but replace the LED display. The clock works well (Tasks are great) but the LCD displays garbage…
Please look through this and tell me where I’m going wrong.
'CLOCKREFRESH - REFRESHES THE CLOCK DISPLAY
·
TASK LCDCLOCKREFRESH
··············· bank @CLOCK
···· Digit VAR byte
·
····· ········· LCDCMD LcdLine2Pos7
··············································· Digit = Hrs··························································································· ' Put Hrs to LCD
··············································· SWAP Digit
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
··············································· Digit = Hrs
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
· ············································· LCDOUT colon
·
··············································· Digit = Mins······················································································· ' Put Mins to LCD
··············································· SWAP Digit
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
··············································· Digit = Mins
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
· ············································· LCDOUT colon
·
··············································· Digit = Secs························································································ ' Put Secs to LCD
··············································· SWAP Digit
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
··············································· Digit = Secs
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
···· ·········· ··············· LCDOUT Digit
·
· LCDCMD LcdLine3Pos8
·
·
ENDTASK
·
·
Regards from the Dark Continent
·
John Bond
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I’m building a component feeder using a SX48 and a LCD 20X4 serial display. The device uses a clock so I decided to use Jon’s Nuts and Volts code but replace the LED display. The clock works well (Tasks are great) but the LCD displays garbage…
Please look through this and tell me where I’m going wrong.
'CLOCKREFRESH - REFRESHES THE CLOCK DISPLAY
·
TASK LCDCLOCKREFRESH
··············· bank @CLOCK
···· Digit VAR byte
·
····· ········· LCDCMD LcdLine2Pos7
··············································· Digit = Hrs··························································································· ' Put Hrs to LCD
··············································· SWAP Digit
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
··············································· Digit = Hrs
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
· ············································· LCDOUT colon
·
··············································· Digit = Mins······················································································· ' Put Mins to LCD
··············································· SWAP Digit
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
··············································· Digit = Mins
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
· ············································· LCDOUT colon
·
··············································· Digit = Secs························································································ ' Put Secs to LCD
··············································· SWAP Digit
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
····· ········· ··············· LCDOUT Digit
·
··············································· Digit = Secs
··············································· Digit = Digit + $0f
··············································· Digit = Digit + AsciiNo
···· ·········· ··············· LCDOUT Digit
·
· LCDCMD LcdLine3Pos8
·
·
ENDTASK
·
·
Regards from the Dark Continent
·
John Bond
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
also I assume your AsciiNo is "0"
····· ········· LCDCMD LcdLine2Pos7
··············································· Digit = Hrs··························································································· ' Put Hrs to LCD
··············································· SWAP Digit
··············································· Digit = Digit &·$0f
··············································· Digit = Digit + "0"
That will give you "0" to "9" in Digit.
This only works if Hrs is stored as a BCD number.
regards peter
I should have known that!!!
Thanks also for the quick response and kind regards
John
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔