Example: SPice10212 calibration with LCD

This is a simple calibration program for controllers with built in LCD. It has been coded for the MMi99/200, but changes for the MS12 are noted.

;cal200.spt SPice20212 demo/calibration using MMi200 with LCD
;Changes for MS12 are noted.

;Use for MS12 only              ON              20      ;MS12 backlight

;Initialize the SPice connector for 3 analog inputs
                SetU            0,3
                SetU            1,3
                SetU            2,3
                SPiceConfigU

;Main program loop:

Loop:
;This section displays the raw analog readings on the
;top line of the display. Full scale is always 255 counts

                AnInE                   ;Use AnInC on MS12
                OBLCD_SetCur    0,0
                OBLCD_UDecDispXFW

                AnInF                   ;Use AnInD on MS12
                OBLCD_SetCur    0,6
                OBLCD_UDecDispXFW

                AnInG                   ;Use AnInE on MS12
                OBLCD_SetCur    0,12
                OBLCD_UDecDispXFW

;This section displays the readings as voltages.
;The scale factor initially loaded into Q will determine the
;full scale range, i.e. the voltage corresponding to 255
;raw counts.

;The scale factor is Vfs/255, where Vfs is the required full scale voltage.

                fLoadQ          0.5176  ;1.035  for FS=265V (240V+10%)
                                        ;0.5176 for FS=132V (120V+10%)

                AnInE                   ;Use AnInC on MS12
                OBLCD_SetCur    1,0
                Float
                fMul
                OBLCD_fDispW    3,0

                AnInF                   ;Use AnInD on MS12
                OBLCD_SetCur    1,6
                Float
                fMul
                OBLCD_fDispW    3,0

                AnInG                   ;Use AnInE on MS12
                OBLCD_SetCur    1,12
                Float
                fMul
                OBLCD_fDispW    3,0

                GoTo            Loop