Hi I am relatively new to PIC programming and am just using it as a hobby.
At present I am familliar with assembly language but only in the very early stages of using C language.
I have had great fun with programming PIC for using LCD display, using 4 bit transfer and two analogue inputs, but I would now like to use Busy check on the LCD so that I don't have to worry about delays and altering osc frequency(within reasonable limits. etc.
To concentrate on getting the B/Flag going properly I have used another program and cut it down to a very simple LCD output (It just writes a name on the bottom line).
If i just use a delay in place of the B/Flag check routine--it works fine, but replacing the delay with the B/Flag routine gives 2 lines and nothing else.
I have checked everywhere I can think of on the net---unfortunately most information is in C language!
If anyone would be kind enough to help (In ASSEMBLY language if possible) I would be most grateful.
I list my B/flag routine ---called Busywait below:-
Any help will be appreciated --many thanks
At present I am familliar with assembly language but only in the very early stages of using C language.
I have had great fun with programming PIC for using LCD display, using 4 bit transfer and two analogue inputs, but I would now like to use Busy check on the LCD so that I don't have to worry about delays and altering osc frequency(within reasonable limits. etc.
To concentrate on getting the B/Flag going properly I have used another program and cut it down to a very simple LCD output (It just writes a name on the bottom line).
If i just use a delay in place of the B/Flag check routine--it works fine, but replacing the delay with the B/Flag routine gives 2 lines and nothing else.
I have checked everywhere I can think of on the net---unfortunately most information is in C language!
If anyone would be kind enough to help (In ASSEMBLY language if possible) I would be most grateful.
I list my B/flag routine ---called Busywait below:-
Rich (BB code):
BUSYWAIT BSF STATUS,5 ;GOTO BANK 1
MOVLW 0FFH ;PORTB ALL INPUTS
MOVWF TRISB
BSF OPTION_R,7 ;DISABLE PULLUPS
BCF STATUS,5 ;RETURN TO BANK 0
STILLBUSY BSF PORTA,3 ;E LINE ENABLE DISPLAY--CLOCK HIGH
BSF PORTA,2 ;R/W LINE SET HIGH TO READ LCD DATA
BCF PORTA,1 ;R/D CLEAR---SET TO COMMAND
NOP ;SMALL DELAY TO ENSURE LCD DATA STABLE
NOP ;SMALL DELAY TO ENSURE LCD DATA STABLE
BCF PORTA,3 ;CLOCK LOW TO SET LCD DATA INTO PORTB 1ST NIBBLE
MOVF PORTB,W ;MOVE PORTB DATA INTO W REG
MOVWF TEMP1 ;MOVE LCD DATA 1ST NIBBLE INTO TEMP1 FILE
BSF PORTA,3 ;CLOCK HIGH ENABLE 2ND NIBBLE FROM LCD
NOP ;SMALL DELAY TO ENSURE LCD DATA STABLE
NOP ;SMALL DELAY TO ENSURE LCD DATA STABLE
BCF PORTA,3 ;CLOCK LOW TO READ 2ND NIBBLE (NOT NEEDED FOR B/F CHECK??)
BTFSC TEMP1,7 ;TEST 1ST NIBBLE (MSB) BUSY FLAG TEMP1,7
GOTO STILLBUSY ;LOOP IF B/F STILL SET
BCF PORTA,2 ;BACK TO WRITE TO LCD MODE
BSF STATUS,5 ;GO TO BANK1
MOVLW 00H ;SET ALL PORTB O/P
MOVWF TRISB
BCF OPTION_R,7 ;RE-ENABLE PORTB PULLUPS
BCF STATUS,5 ;RETURN TO BANK 0
RETLW 0 ;RETURN W REG CLEARED
Last edited by a moderator: