Shop OBEX P1 Docs P2 Docs Learn Events
Help with the new TASK function — Parallax Forums

Help with the new TASK function

John BondJohn Bond Posts: 369
edited 2009-03-26 09:41 in General Discussion
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

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2009-03-26 07:54
    You need the AND operator ( & ) to extract nibbles,
    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
  • John BondJohn Bond Posts: 369
    edited 2009-03-26 09:41
    Thanks Peter

    I should have known that!!!

    Thanks also for the quick response and kind regards
    John

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.