;************************************************************************************* ;Program that communicates with a keypad and displays only * to mask the number. * ;This display indicates the mode that it is in. The six digit code is input and a * ;calculation is done to determine if the code is correct. * ;*********02/12/2003*****************15H15**********************************BJB******* ;************************************************************************************* ; Setup * ;************************************************************************************* LIST P=16F84A ;Processor type ERRORLEVEL -302 ;Suppress warning of bank 1 operands INCLUDE "P16F84A.INC" ; MYREG EQU 0X20 ; OUTPUT EQU 0X21 ;This reg for data reading to out pin MYREG1 EQU 0X22 ; MYREG2 EQU 0X23 ; COUNTER EQU 0X24 ; DIGITS EQU 0X25 ; FLASH1 EQU 0X28 ; DELAY2 EQU 0X29 ; DELAY3 EQU 0X2A ; COUNTER1 EQU 0X2B ; NUMBER1 EQU 0X2C ; NUMBER2 EQU 0X2D ; NUMBER3 EQU 0X2E ; NUMBER4 EQU 0X2F ; NUMBER5 EQU 0X30 ; NUMBER6 EQU 0X31 ; CODEDATA EQU 0X32 ; CLRF CODEDATA ; CLRF NUMBER1 ; CLRF NUMBER2 ; CLRF NUMBER3 ; CLRF NUMBER4 ; CLRF NUMBER5 ; CLRF NUMBER6 ; CLRF COUNTER ; CLRF OUTPUT ; CLRF MYREG ; CLRF MYREG1 ; CLRF MYREG2 ; CLRF DIGITS ; CLRF FLASH1 ; CLRF COUNTER1 ; BSF STATUS,5 ;Select bank 1 MOVLW 0X00 ;All outputs MOVWF TRISA ;Ditto MOVLW 0X0F ;Lower nibble is inputs MOVWF TRISB ;Ditto BCF STATUS,5 ;Back to bank 0 BCF PORTB,7 ;R/S Set to zero- command mode CLRF PORTA ;Ensure all outputs are at zero GOTO START ; ;************************************************************************************* ; Pinout use * ;************************************************************************************* ;PORTA , 0 is column 1 ;PORTA , 1 is column 2 ;PORTA , 2 is column 3 ;PORTB , 0 is scanning row 1 ;PORTB , 1 is scanning row 2 ;PORTB , 2 is scanning row 3 ;PORTB , 3 is scanning row 4 ;PORTB , 4 is clock output ;PORTB , 5 is serial output pin ;PORTB , 6 is enable ;PORTB , 7 is R/S pin ;************************************************************************************* ; Subroutines * ;************************************************************************************* ENABLE BSF PORTB,6 ;Set ENABLE pin high CALL DELAY ;Minimum setup time for the LCD BCF PORTB,6 ;Falling edge needed to trigger LCD CALL DELAY ;Kill some time RETURN ; DELAY MOVLW 0xFF ;Load 255 into W-register MOVWF MYREG ;Move this data into MYREG LOOP DECFSZ MYREG,1 ;Decrement MYREG, ans into MYREG GOTO LOOP ;Loop program till MYREG = 0 RETURN ; LONGDELAY MOVLW 0XFF ; MOVWF DELAY2 ; LOOP2 DECFSZ DELAY2,1 ; GOTO LDELAY ; RETURN ; LDELAY MOVLW 0XFF ; MOVWF DELAY3 ; LOOP3 DECFSZ DELAY3,1 ; GOTO LOOP3 ; GOTO LOOP2 ; DELAY1 MOVLW 0x60 ;Load 96 into W-register MOVWF MYREG2 ;Move this data into MYREG LOOP1 DECFSZ MYREG2,1 ;Decrement MYREG, ans into MYREG GOTO LOOP1 ;Loop program till MYREG = 0 RETURN CLOCK BCF PORTB,4 ;Ensure that *Clock starts at 0 BSF PORTB,4 ;Clock value HIGH CALL DELAY ;Kill some time BCF PORTB,4 ;Falling edge *Clock CALL DELAY ;Kill some time RETURN ; SERIAL MOVWF OUTPUT ;Moved data from W to OUTPUT reg SERIAL1 BCF PORTB,5 ;Ensure that SERIAL pin starts @ 0 MOVLW 0x04 ;There are 4 bits to a nibble MOVWF MYREG1 ;Nibble control for escape TEST BTFSC OUTPUT,7 ;Test data bit 7 BSF PORTB,5 ;SET SERIAL pin to 1 CALL CLOCK ;Clock the data to shift register BCF PORTB,5 ;Reset SERIAL pin for next test RLF OUTPUT,1 ;Rotate the OUTPUT register left DECFSZ MYREG1,1 ;Decrement MYREG1, ans into MYREG1 GOTO TEST ;Do next bit of the word till all done CALL ENABLE ;Enable the LCD to read the data RETURN ;Escape after the word is output EX1 MOVF CODEDATA,0 ;Move data to w_reg MOVWF NUMBER1 ;Move to number1 reg RETURN ; EX2 MOVF CODEDATA,0 ;Move data to w_reg MOVWF NUMBER2 ;Move to number2 reg RETURN ; EX3 MOVF CODEDATA,0 ;Move data to w_reg MOVWF NUMBER3 ;Move to number3 reg RETURN ; EX4 MOVF CODEDATA,0 ;Move data to w_reg MOVWF NUMBER4 ;Move to number4 reg RETURN ; EX5 MOVF CODEDATA,0 ;Move data to w_reg MOVWF NUMBER5 ;Move to number5 reg RETURN ; EX6 MOVF CODEDATA,0 ;Move data to w_reg MOVWF NUMBER6 ;Move to number6 reg GOTO CHECK ; ;************************************************************************************* ; LCD Initialise * ;************************************************************************************* START MOVLW 0x20 ;4 bit CALL SERIAL ;Move this data to the shift register MOVLW 0x28 ;4 bit, 2 line, 7x5 matrix CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0x0C ;Disp ON, no cursor CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0x02 ;Display & curser home CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0x01 ;Clear display CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0XC0 ;Address 40 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot ; ;************************************************************************************* ; INTRO * ;************************************************************************************* MOVLW 0X03 ;This is for three tries MOVWF COUNTER1 ;Counter for amount of attempts ZERO BSF PORTB,7 ;Character mode MOVLW 'D' ;D CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'i' ;i CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 's' ;s CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW '-' ;- CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'a' ;a CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'r' ;r CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'm' ;m CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'i' ;i CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'n' ;n CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'g' ;g CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW ' ' ; CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'C' ;C CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'o' ;o CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'd' ;d CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'e' ;e CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW '?' ;? CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BCF PORTB,7 ;Command mode MOVLW 0X85 ;Address CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot ;************************************************************************************* ; MAIN * ;************************************************************************************* CLEARS MOVLW 0X06 ;Setup maximum digits used MOVWF DIGITS ;This is the max digit used reg TESTDATA MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;After movf, leave a copy again in DIGITS XORLW 0X06 ;Has a digit been input ? BTFSC STATUS,Z ;Well, has it CLRF CODEDATA ;Ensure that reg CODEDATA is empty MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;Re-input number of digits left into W XORLW 0X05 ;2nd digit to follow ? BTFSC STATUS,Z ;Well, is it ? CALL EX1 ;Put the numeric value into the correct ;NUMBER register MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;Re-input number of digits left into W XORLW 0X04 ;3rd digit to follow ? BTFSC STATUS,Z ;Well, is it ? CALL EX2 ;Put the numeric value into the correct ;NUMBER register MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;Re-input number of digits left into W XORLW 0X03 ;4th digit to follow ? BTFSC STATUS,Z ;Well, is it ? CALL EX3 ;Put the numeric value into the correct ;NUMBER register MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;Re-input number of digits left into W XORLW 0X02 ;5th digit to follow ? BTFSC STATUS,Z ;Well, is it ? CALL EX4 ;Put the numeric value into the correct ;NUMBER register MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;Re-input number of digits left into W XORLW 0X01 ;6th digit to follow ? BTFSC STATUS,Z ;Well, is it ? CALL EX5 ;Put the numeric value into the correct ;NUMBER register MOVF DIGITS,0 ;Re-input number of digits left into W MOVWF DIGITS ;Re-input number of digits left into W XORLW 0X00 ;All six digits in ? BTFSC STATUS,Z ;Well, is it ? GOTO EX6 ;Put the numeric value into the correct ;NUMBER register BSF PORTA,0 ;Poke column 1 high CALL DETERMINE ;Check PORTB lower nibble for change BCF PORTA,0 ;Clear column 1 BSF PORTA,1 ;Poke column 2 high CALL DETERMINE ;Check PORTB lower nibble for change BCF PORTA,1 ;Clear column 2 BSF PORTA,2 ;Poke column 3 high CALL DETERMINE ;Check PORTB lower nibble for change BCF PORTA,2 ;Clear column 3 GOTO TESTDATA ;Loop, check everything again ;************************************************************************************* ; CALCULATION * ;************************************************************************************* CHECK MOVF NUMBER1,0 ;Put numeric input 1 into W register XORLW 0X05 ;Is the first saved value 5? BTFSS STATUS,Z ;Well, is it ? GOTO LOCKED ;No? start from scratch MOVF NUMBER2,0 ;Put numeric input 2 into W register XORLW 0X09 ;Is the second saved value 9? BTFSS STATUS,Z ;Well, is it ? GOTO LOCKED ;No? start from scratch MOVF NUMBER3,0 ;Put numeric input 3 into W register XORLW 0X07 ;Is the third saved value 7? BTFSS STATUS,Z ;Well, is it ? GOTO LOCKED ;No? start from scratch MOVF NUMBER4,0 ;Put numeric input 4 into W register XORLW 0X05 ;Is the fourth saved value 5? BTFSS STATUS,Z ;Well, is it ? GOTO LOCKED ;No? start from scratch MOVF NUMBER5,0 ;Put numeric input 5 into W register XORLW 0X03 ;Is the fifth saved value 3? BTFSS STATUS,Z ;Well, is it ? GOTO LOCKED ;No? start from scratch MOVF NUMBER6,0 ;Put numeric input 6 into W register XORLW 0X01 ;Is the sixth saved value 1? BTFSS STATUS,Z ;Well, is it ? GOTO LOCKED ;No? start from scratch GOTO TWO ;Good the code is correct ;************************************************************************************* ; DETERMINATION * ;************************************************************************************* DETERMINE BTFSC PORTB,0 ;Check first row GOTO DEBOUNCE ;Run debounce subroutine BTFSC PORTB,1 ;Check second row GOTO DEBOUNCE1 ;Run debounce routine BTFSC PORTB,2 ;Check third row GOTO DEBOUNCE2 ;Run debounce routine BTFSC PORTB,3 ;Check fouth row GOTO DEBOUNCE3 ;Run debounce routine RETURN ; DEBOUNCE MOVLW 0X04 ;The amount of samples MOVWF COUNTER ;The sample register TESTING CALL DELAY1 ;Kill some time BTFSS PORTB,0 ;Re-check this bit GOTO START ;False trigger, escape to start DECFSZ COUNTER,1 ;Re-sample 4 times GOTO TESTING ;Ditto TEST1 BTFSC PORTB,0 ;Wait for release GOTO TEST1 ;Ditto BSF PORTB,7 ;R/S set to 1 for character display BTFSC PORTA,0 ;Was it the first column? GOTO i1 ;This is the character (without i ) BTFSC PORTA,1 ;Was it the second column? GOTO i2 ;This is the character (without i ) BTFSC PORTA,2 ;Was it the third column? GOTO i3 ;This is the character (without i ) GOTO START ; i1 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X01 ;Numeric value 1 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i2 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X02 ;Numeric value 2 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i3 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X03 ;Numeric value 3 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning DEBOUNCE1 MOVLW 0X04 ;The amount of samples MOVWF COUNTER ;The sample register TESTING1 CALL DELAY1 ;Kill some time BTFSS PORTB,1 ;Re-check this bit GOTO START ;False trigger, escape to start DECFSZ COUNTER,1 ;Re-sample 4 times GOTO TESTING1 ;Ditto TEST2 BTFSC PORTB,1 ;Wait for release GOTO TEST2 ;Ditto BSF PORTB,7 ;R/S set to 1 for character display BTFSC PORTA,0 ;Was it the first column? GOTO i4 ;This is the character (without i ) BTFSC PORTA,1 ;Was it the second column? GOTO i5 ;This is the character (without i ) BTFSC PORTA,2 ;Was it the third column? GOTO i6 ;This is the character (without i ) GOTO START ; i4 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X04 ;Numeric value 4 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i5 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X05 ;Numeric value 5 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i6 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X06 ;Numeric value 6 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning DEBOUNCE2 MOVLW 0X04 ;The amount of samples MOVWF COUNTER ;The sample register TESTING2 CALL DELAY1 ;Kill some time BTFSS PORTB,2 ;Re-check this bit GOTO START ;False trigger, escape to start DECFSZ COUNTER,1 ;Re-sample 4 times GOTO TESTING2 ;Ditto TEST3 BTFSC PORTB,2 ;Wait for release GOTO TEST3 ;Ditto BSF PORTB,7 ;R/S set to 1 for character display BTFSC PORTA,0 ;Was it the first column? GOTO i7 ;This is the character (without i ) BTFSC PORTA,1 ;Was it the second column? GOTO i8 ;This is the character (without i ) BTFSC PORTA,2 ;Was it the third column? GOTO i9 ;This is the character (without i ) GOTO START ; i7 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X07 ;Numeric value 7 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i8 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X08 ;Numeric value 8 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i9 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X09 ;Numeric value 9 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning DEBOUNCE3 MOVLW 0X04 ;The amount of samples MOVWF COUNTER ;The sample register TESTING3 CALL DELAY1 ;Kill some time BTFSS PORTB,3 ;Re-check this bit GOTO START ;False trigger, escape to start DECFSZ COUNTER,1 ;Re-sample 4 times GOTO TESTING3 ;Ditto TEST4 BTFSC PORTB,3 ;Wait for release GOTO TEST4 ;Ditto BSF PORTB,7 ;R/S set to 1 for character display BTFSC PORTA,0 ;Was it the first column? GOTO ix ;This is the character (without i ) BTFSC PORTA,1 ;Was it the second column? GOTO i0 ;This is the character (without i ) BTFSC PORTA,2 ;Was it the third column? GOTO i# ;This is the character (without i ) GOTO START ;Wasn't triggered,check again ix MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X2A ;ASCII symbol * MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i0 MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X00 ;Numeric value 0 MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning i# MOVLW '*' ;* CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X23 ;ASCII symbol # MOVWF CODEDATA ;Save data for manipulation DECF DIGITS,1 ;Reduce digits register BCF PORTB,7 ;Command mode GOTO TESTDATA ;Redo the keypad scanning ;************************************************************************************* ; OUTCOMES * ;************************************************************************************* LOCKED BCF PORTB,7 ;Command mode BSF PORTA,4 ;Red LED on MOVLW 0X01 ;Clear display CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X06 ;Increment display shift off CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X86 ;Address 6 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BSF PORTB,7 ;Character mode MOVLW 'W' ;W CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'R' ;R CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'O' ;O CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'N' ;N CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'G' ;G CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BCF PORTB,7 ;Command mode MOVLW 0XC6 ;Address 45 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BSF PORTB,7 ;Character mode MOVLW 'C' ;C CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'O' ;O CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'D' ;D CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'E' ;E CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BCF PORTB,7 ;Command mode MOVLW 0X0A ;Flash 10 times MOVWF FLASH1 ;Flashing counter FLASH MOVLW 0X08 ;Display off CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot CALL LONGDELAY ;Kill a long time MOVLW 0X0C ;Display on CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot CALL LONGDELAY ;Kill a long time DECFSZ FLASH1,1 ;Reduce amount of flashes by 1 GOTO FLASH ;Make the display flash on and off BCF PORTB,7 ;Command mode MOVLW 0X01 ;Clear display CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0XC0 ;Address 40 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BCF PORTA,4 ;Red LED off DECFSZ COUNTER1,1 ;Count if max attempt reached GOTO ZERO ;Re-ask for the code ONE BSF PORTA,4 ;Red LED on BCF PORTB,7 ;Command mode MOVLW 0X01 ;Clear display CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X85 ;Address 05 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BSF PORTB,7 ;Character mode MOVLW 'L' ;L CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'O' ;O CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'C' ;C CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'K' ;K CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'E' ;E CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'D' ;D CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BCF PORTB,7 ;Command mode MOVLW 0XC0 ;Address 40 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BSF PORTB,7 ;Character mode MOVLW 'U' ;U CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 's' ;s CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'e' ;e CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW ' ' ; CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'M' ;M CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'a' ;a CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 's' ;s CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 't' ;t CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'e' ;e CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'r' ;r CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW ' ' ; CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'C' ;C CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'o' ;o CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'd' ;d CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'e' ;e CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot GOTO $ ; TWO BCF PORTB,7 ;Command mode MOVLW 0X01 ;Clear display CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 0X82 ;Address 02 CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot BSF PORTA,3 ;Green LED on BSF PORTB,7 ;Character mode MOVLW 'D' ;D CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'e' ;e CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW '-' ;- CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'A' ;a CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'c' ;c CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 't' ;t CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'i' ;i CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'v' ;v CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'a' ;a CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 't' ;t CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'e' ;e CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot MOVLW 'd' ;d CALL SERIAL ;This will output 4 bits only CALL SERIAL1 ;cause the low 4 are already high rot ;************************************************************************************* GOTO $ ; END
See:
Questions:
Comments:
file: /Techref/microchip/3x4Key-4bLCD-Lock.htm, 49KB, , updated: 2008/7/6 15:33, local time: 2024/11/14 23:06,
owner: bj-hotmail-,
3.139.104.16:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/microchip/3x4Key-4bLCD-Lock.htm"> PIC Microcontroler 3x4 Keypad Lock w/ 4 bit LCD </A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.