;*************************************************************************** ; ; 16 Bit Binary Output on LCD Display for PIC 16XXX ; ================================================= ; ; written by Peter Luethi, 02.08.1999, Dietikon, Switzerland ; http://www.electronic-engineering.ch ; last update: 20.08.2004 ; ; V1.00: Initial release (02.08.1999) ; ; This code and accompanying files may be distributed freely and ; modified, provided this header with my name and this notice remain ; intact. Ownership rights remain with me. ; You may not sell this software without my approval. ; ; This software comes with no guarantee or warranty except for my ; good intentions. By using this code you agree to indemnify me from ; any liability that might arise from its use. ; ; ; SPECIFICATIONS: ; =============== ; Processor: Microchip PIC 16XXX ; Binary Range: 16 Bit ; ; ; DESCRIPTION: ; ============ ; Developed on PIC 16C84, but executeable on all PIC 16XXX. ; Displays the 16 bit binary value stored in HI & LO on the ; LCD display in binary format (consecutive order). ; This routine is only used for debugging registers and bit- ; streams. ; ; ; NOTE: ; ===== ; Call of implemented procedure with: ; "LCDbin_16", value in HI & LO ; ; HI & LO are not altered or cleared during operation and are ; still valid after termination of this routine. ; During the whole routine, LO_TEMP, HI_TEMP and b16_cnt must NOT ; be used by other routines ! ======== ; ; ; DECLARATIONS needed in MAIN PROGRAM : ; ===================================== ; CONSTANT BASE = 0x0C ; Base address of user file registers ; b16_cnt equ BASE+? ; counter ; LO equ BASE+? ; LO_TEMP equ BASE+? ; HI equ BASE+? ; HI_TEMP equ BASE+? ; is only used for flag bit ; ; ; REQUIRED MEMORY: ; ================ ; 5 registers declared in main program. ; needs itself 1 stack level, but LCDw needs some more ; ;*************************************************************************** ;***** INCLUDE FILES ***** IFNDEF M_LCD_ID ERROR "Missing include file: m_lcd.asm or similar" ENDIF ;***** REGISTER DECLARATION ***** IFNDEF b16_cnt ERROR "ModuleError: Declare b16_cnt in MAIN PROGRAM" ENDIF IFNDEF LO ERROR "ModuleError: Declare LO in MAIN PROGRAM" ENDIF IFNDEF LO_TEMP ERROR "ModuleError: Declare LO_TEMP in MAIN PROGRAM" ENDIF IFNDEF HI ERROR "ModuleError: Declare HI in MAIN PROGRAM" ENDIF IFNDEF HI_TEMP ERROR "ModuleError: Declare HI_TEMP in MAIN PROGRAM" ENDIF ;***** MACROS ***** LCDbin_16 macro call LCDbin16 endm ;***** SUB-ROUTINES ***** LCDbin16 bsf HI_TEMP,0 ; set flag for first run with HI movfw HI ; upper 8 bit to display = HI bin_16 movwf LO_TEMP movlw d'8' movwf b16_cnt bin_loop16 movlw '0' btfsc LO_TEMP,7 ; check if bit is set, skip if cleared movlw '1' LCDw ; call LCD sub-routine with data stored in w rlf LO_TEMP,1 decfsz b16_cnt,1 goto bin_loop16 btfss HI_TEMP,0 ; check flag, skip if set RETURN bcf HI_TEMP,0 ; clear flag: second run with LO movfw LO ; lower 8 bit to display = LO goto bin_16 ; re-enter for the second run