SPLatco Knowledge Base

The following program counts a counter up and down on inputs 2 and 1 respectively, and redraws a horizontal bargraph on input 3. (Note: Requires a controller with dialect 18 or later).

;Horizontal graph example
;Input 2 increments value
;Input 3 decrements value
;Input 3 updates the display
Counter defBYTE

        OBLCD_SetCur    0,0
        OBLCD_Text      "E              F"

Wait:
        InputK          3
        GoSubIfT        Graphit
        InputK          2
        GoSubIfT        Up
        InputK          1
        GoSubIfT        Dn
        GoTo            Wait
Up:
        GoIfMGT         Counter,69,UpRet
        IncM            Counter
UpRet:  Return

Dn:
        RetIfMZ         Counter
        DecM            Counter
        Return

Graphit:
        LoadX           70      ;total scale length in pixels
        Recall          Counter
        OBLCD_SetCur    0,1
        OBLCD_HGRaph
        Return