Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

NIGEL PIC Tutorial Hardware phần 6 pot
Nội dung xem thử
Mô tả chi tiết
retlw 'n'
retlw 't'
retlw 'e'
retlw 'r'
retlw '.'
retlw 0x00
Start movlw 0x07
movwf CMCON ;turn comparators off (make it
like a 16F84)
Initialise clrf count
clrf PORTA
clrf PORTB
clrf NumL
clrf NumH
SetPorts bsf STATUS, RP0 ;select bank 1
movlw 0x00 ;make all pins outputs
movwf LCD_TRIS
movwf TRISB
bcf STATUS, RP0 ;select bank 0
call LCD_Init ;setup LCD
clrf count ;set counter register to zero
Message movf count, w ;put counter value in W
call Text ;get a character from the text
table
xorlw 0x00 ;is it a zero?
btfsc STATUS, Z
goto NextMessage
call LCD_Char
incf count, f
goto Message
NextMessage movlw d'2'
call LCD_Line2W ;move to 2nd row, third column
call Convert ;convert to decimal
movf TenK, w ;display decimal characters
call LCD_CharD ;using LCD_CharD to convert to
ASCII
movf Thou, w
call LCD_CharD
movf Hund, w
call LCD_CharD
movf Tens, w
call LCD_CharD
movf Ones, w
call LCD_CharD
movlw ' ' ;display a 'space'
call LCD_Char
movf NumH, w ;and counter in hexadecimal
call LCD_HEX
movf NumL, w
call LCD_HEX
incfsz NumL, f
goto Next