;=============================================================================== ; SPLat Controls. ; ; Product Development Group ; ; Melbourne, AUSTRALIA ; ;=============================================================================== ;PURPOSE: ; Helper subroutines for displaying numbers and characters on the HD8's ; 7 segment displays. ; ;=============================================================================== ;=============================================================================== ; Copyright (c) 2015 SPLat Controls. All rights reserved. ; ; ; ; THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SPLat Controls. ; ; The copyright notice above does not evidence any ; ; actual or intended publication of such source code. ; ;=============================================================================== ;=============================================================================== ; ; ; ;=============================================================================== ;=============================================================================== ; ; ; ;=============================================================================== ;-- Character Equates Char_A equ %01110111 ;A 0 Char_b equ %01111100 ;b 1 Char_C equ %00111001 ;C 2 Char_d equ %01011110 ;d 3 Char_E equ %01111001 ;E 4 Char_F equ %01110001 ;F 5 Char_G equ %00111101 ;G 6 Char_H equ %01110110 ;H 7 Char_i equ %00000100 ;i 8 Char_L equ %00111000 ;L 9 Char_o equ %01011100 ;o 10 Char_P equ %01110011 ;P 11 Char_r equ %01010000 ;r 12 Char_S equ %01101101 ;S 13 Char_t equ %01111000 ;t 14 Char_u equ %00011100 ;u 15 Char_y equ %01101110 ;y 16 ;=============================================================================== ; ; ;RAM storage ; ;=============================================================================== ;=============================================================================== ; ; ;I/O Assignments ; ;=============================================================================== ;-- includes -- ;-- digital inputs -- ;-- digital outputs -- Digit1 EQU 5 decP1 oEQU 12 decP2 oEQU 20 Digit2 EQU 13 Digit3 EQU 21 ;-- analogue inputs -- ;-- analogue outputs -- ;-- serial -- ;=============================================================================== ; ;AUTOMATIC RAM ; ;=============================================================================== ; ; abDigits defBYTE 3 ; ; ; ; ;=============================================================================== ; ; ; ;=============================================================================== ;=============================================================================== ;DESCRIPTION: ; Subroutine to display the number in W 0 --> 999 on the 7 segment display. The ; value in X sets the position of the decimal point. ; X=0 no decimal point ; X=1 XX.X ; X=2 X.XX ;PARAMETERS: ; -> w: number to display ; -> x: decimal point position ;RETURNS: ; <- Nil ;=============================================================================== subDispNumber: PopU 9 ;remember the dp position LoadI 0 iifPrintWFW abDigits,3,0 ;convert the number to ASCII LoadI 0 ;convert and display.. GoSub subConv7Seg LoadX 255 OutputM Digit1 ;..the first digit IncI ;convert and display.. GoSub subConv7Seg LoadX 255 OutputM Digit2 ;..the second digit IncI ;convert and display.. GoSub subConv7Seg LoadX 255 OutputM Digit3 ;..the third digit PushU 9 ;recall the dp position Push GoIfXgt 2,_DispNumberEnd ;end of out of range Branch Target _DispNumberEnd Target dp2 Target dp1 dp2 On decP2 Goto _DispNumberEnd dp1 On decP1 _DispNumberEnd Return subConv7Seg iRecall abDigits ;get the ASCII Push GoIfXeq " ",_LoadSpace ;jump if it's a space LoadX '30 ;convert ASCII to.. Sub ;..a number Push GoIfXgt 9,_LoadDash ;go display a dash if it's not a number GoSub subGet7seg ;owise convert the number to 7 segment data Return _LoadSpace LoadX %00000000 ;load a space Return _LoadDash LoadX %01000000 ;load a dash Return ;=============================================================================== ;DESCRIPTION: ; Subroutine to Return the 7 segment data for the digit in X ;PARAMETERS: ; -> x: number ;RETURNS: ; <- x: 7 segment data ;=============================================================================== subGet7seg: NVSetPtr p7 NVsetRecLen 1 NVPopRecNum NVPushByte 0 Return p7 NV0Byte %00111111 ; 0 NV0Byte %00000110 ; 1 NV0Byte %01011011 ; 2 NV0Byte %01001111 ; 3 NV0Byte %01100110 ; 4 NV0Byte %01101101 ; 5 NV0Byte %01111101 ; 6 NV0Byte %00000111 ; 7 NV0Byte %01111111 ; 8 NV0Byte %01101111 ; 9 ;=============================================================================== ;DESCRIPTION: ; Subroutine to blank the whole display. ;PARAMETERS: ; -> Nil ;RETURNS: ; <- Nil ;=============================================================================== subBlankDisplay: LoadX 0 LoadX 255 OutputM Digit1 LoadX 0 LoadX 255 OutputM Digit2 LoadX 0 LoadX 255 OutputM Digit3 Return