⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tenbit.sdi

📁 代码保护功能处于持续发展中。Microchip 承诺将不断改进产品的代码保护功能。任何试图破坏Microchip 代码保护功能的行为均可视 为违反了《数字器件千年版权法案(Digital Mille
💻 SDI
📖 第 1 页 / 共 2 页
字号:
00000055,02B2,,        SUBWF   ADlo            ; and subtract from result
00000056,1C03,,        BTFSS   STATUS,C        ; and check if done
00000057,285A,,        GOTO    remt            ; yes, restore remainder
00000058,0AB5,,        INCF    tens            ; no, count number of loops
00000059,2853,,        GOTO    subt            ; and repeat
,,,
,,,
,,,; Restore remainder.........................................
,,,
0000005A,07B2,remt,remt    ADDWF   ADlo            ; yes, add 10 back on
0000005B,0832,,        MOVF    ADlo,W          ; load remainder
0000005C,00B6,,        MOVWF   ones            ; and store as ones digit
,,,
0000005D,0008,,        RETURN                  ; done
,,,
,,,
,,,;-----------------------------------------------------------
,,,; Output to display
,,,;-----------------------------------------------------------
,,,
0000005E,10F4,putLCD,putLCD  BCF     Select,RS       ; set display command mode
0000005F,3080,,        MOVLW   080             ; code to home cursor
00000060,208E,,        CALL    send            ; output it to display
00000061,14F4,,        BSF     Select,RS       ; and restore data mode
,,,
,,,; Convert digits to ASCII and display.......................
,,,
00000062,3030,,        MOVLW   030             ; load ASCII offset
00000063,07B3,,        ADDWF   thos            ; convert thousands to ASCII
00000064,07B4,,        ADDWF   huns            ; convert hundreds to ASCII
00000065,07B5,,        ADDWF   tens            ; convert tens to ASCII
00000066,07B6,,        ADDWF   ones            ; convert ones to ASCII
,,,
00000067,0833,,        MOVF    thos,W          ; load thousands code
00000068,208E,,        CALL    send            ; and send to display
00000069,302E,,        MOVLW   '.'             ; load point code
0000006A,208E,,        CALL    send            ; and output
0000006B,0834,,        MOVF    huns,W          ; load hundreds code
0000006C,208E,,        CALL    send            ; and send to display
0000006D,0835,,        MOVF    tens,W          ; load tens code
0000006E,208E,,        CALL    send            ; and output
0000006F,0836,,        MOVF    ones,W          ; load ones code
00000070,208E,,        CALL    send            ; and output
00000071,3020,,        MOVLW   ' '             ; load space code
00000072,208E,,        CALL    send            ; and output
00000073,3056,,        MOVLW   'V'             ; load volts code
00000074,208E,,        CALL    send            ; and output
00000075,306F,,        MOVLW   'o'             ; load volts code
00000076,208E,,        CALL    send            ; and output
00000077,306C,,        MOVLW   'l'             ; load volts code
00000078,208E,,        CALL    send            ; and output
00000079,3074,,        MOVLW   't'             ; load volts code
0000007A,208E,,        CALL    send            ; and output
0000007B,3073,,        MOVLW   's'             ; load volts code
0000007C,208E,,        CALL    send            ; and output
,,,
0000007D,0008,,        RETURN                  ; done
,,,
,,,;----------------------------------------------------------
,,,; INCLUDED ROUTINES
,,,;----------------------------------------------------------
,,,; Include LCD driver routine
,,,;
,,,        INCLUDE "LCDIS.INC"
,,,;       LCDIS.INC               MPB     19-12-05
,,,;
,,,;       Include file to operate 16x2 LCD display
,,,;       Uses GPR 70 - 75
,,,;
,,,;       Final version
,,,;-------------------------------------------------------------------------------------------
,,,
,,,Timer1  EQU     70              ; 1ms count register
,,,TimerX  EQU     71              ; Xms count register
,,,Var     EQU     72              ; Output variable
,,,Point   EQU     73              ; Program table pointer
,,,Select  EQU     74              ; Used to set or clear RS bit
,,,OutCod  EQU     75              ; Temp store for output code
,,,
,,,RS      EQU     1               ; Register select output bit
,,,E       EQU     2               ; Enable output clocks display input
,,,
,,,
,,,;--------------------------------------------------------------------------------------------
,,,;       1ms delay with 1us cycle time (1000 cycles)
,,,;--------------------------------------------------------------------------------------------
0000007E,30F9,onems,onems   MOVLW   D'249'          ; Count for 1ms delay
0000007F,00F0,,        MOVWF   Timer1          ; Load count
00000080,0000,loop1,loop1   NOP                     ; Pad for 4 cycle loop
00000081,0BF0,,        DECFSZ  Timer1          ; Count
00000082,2880,,        GOTO    loop1           ; until Z
00000083,0008,,        RETURN                  ; and finish
,,,
,,,;---------------------------------------------------------------------------------------------
,,,;       Delay Xms
,,,;       Receives count in W, uses Onems
,,,;---------------------------------------------------------------------------------------------
00000084,00F1,xms,xms     MOVWF   TimerX          ; Count for X ms
00000085,207E,loopX,loopX   CALL    onems           ; Delay 1ms
00000086,0BF1,,        DECFSZ  TimerX          ; Repeat X times
00000087,2885,,        GOTO    loopX           ; until Z
00000088,0008,,        RETURN                  ; and finish
,,,
,,,;---------------------------------------------------------------------------------------------
,,,;       Generate data/command clock siganl E
,,,;---------------------------------------------------------------------------------------------
00000089,1508,pulseE,pulseE  BSF     PORTD,E         ; Set E high
0000008A,207E,,        CALL    onems           ; Delay 1ms
0000008B,1108,,        BCF     PORTD,E         ; Reset E low
0000008C,207E,,        CALL    onems           ; Delay 1ms
0000008D,0008,,        RETURN                  ; done
,,,
,,,;---------------------------------------------------------------------------------------------
,,,;       Send a command byte in two nibbles from RB4 - RB7
,,,;       Receives command in W, uses PulseE and Onems
,,,;---------------------------------------------------------------------------------------------
0000008E,00F5,send,send    MOVWF   OutCod          ; Store output code
0000008F,39F0,,        ANDLW   0F0             ; Clear low nybble
00000090,0088,,        MOVWF   PORTD           ; Output high nybble
00000091,18F4,,        BTFSC   Select,RS       ; Test RS bit
00000092,1488,,        BSF     PORTD,RS        ; and set for data
00000093,2089,,        CALL    pulseE          ; and clock display register
00000094,207E,,        CALL    onems           ; wait 1ms for display to complete
,,,
00000095,0EF5,,        SWAPF   OutCod          ; Swap low and high nybbles
00000096,0875,,        MOVF    OutCod,W        ; Retrieve output code
00000097,39F0,,        ANDLW   0F0             ; Clear low nybble
00000098,0088,,        MOVWF   PORTD           ; Output low nybble
00000099,18F4,,        BTFSC   Select,RS       ; Test RS bit
0000009A,1488,,        BSF     PORTD,RS        ; and set for data
0000009B,2089,,        CALL    pulseE          ; and clock display register
0000009C,207E,,        CALL    onems           ; wait 1ms for display to complete
0000009D,0008,,        RETURN                  ; done
,,,
,,,;---------------------------------------------------------------------------------------------
,,,;       Initialise the display
,,,;       Uses Send
,,,;---------------------------------------------------------------------------------------------
0000009E,3064,inid,inid    MOVLW   D'100'          ; Load count for 100ms delay
0000009F,2084,,        CALL    xms             ; and wait for display start
000000A0,30F0,,        MOVLW   0F0             ; Mask for select code
000000A1,00F4,,        MOVWF   Select          ; High nybble not masked
,,,
000000A2,3030,,        MOVLW   0x30            ; Load initial nibble
000000A3,0088,,        MOVWF   PORTD           ; and output it to display
000000A4,2089,,        CALL    pulseE          ; Latch initial code
000000A5,3005,,        MOVLW   D'5'            ; Set delay 5ms
000000A6,2084,,        CALL    xms             ; and wait
000000A7,2089,,        CALL    pulseE          ; Latch initial code again
000000A8,207E,,        CALL    onems           ; Wait 1ms
000000A9,2089,,        CALL    pulseE          ; Latch initial code again
000000AA,1208,,        BCF     PORTD,4         ; Set 4-bit mode
000000AB,2089,,        CALL    pulseE          ; Latch it
,,,
000000AC,3028,,        MOVLW   0x28            ; Set 4-bit mode, 2 lines
000000AD,208E,,        CALL    send            ; and send code
000000AE,3008,,        MOVLW   0x08            ; Switch off display
000000AF,208E,,        CALL    send            ; and send code
000000B0,3001,,        MOVLW   0x01            ; Code to clear display
000000B1,208E,,        CALL    send            ; and send code
000000B2,3006,,        MOVLW   0x06            ; Enable cursor auto inc
000000B3,208E,,        CALL    send            ; and send code
000000B4,3080,,        MOVLW   0x80            ; Zero display address
000000B5,208E,,        CALL    send            ; and send code
000000B6,300C,,        MOVLW   0x0C            ; Turn on display
000000B7,208E,,        CALL    send            ; and send code
,,,
000000B8,0008,,        RETURN                  ; Done
,,,
,,,;
,,,;       Contains routines:
,,,;       init:   Initialises display
,,,;       onems:  1 ms delay
,,,;       xms:    X ms delay
,,,;               Receives X in W
,,,;       send:   sends a character to display
,,,;               Receives: Control code in W (Select,RS=0)
,,,;                         ASCII character code in W (RS=1)
,,,;
,,,;----------------------------------------------------------
,,,        END                     ; of source code

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -