Interfacing PIC Microcontrollers 15. Explore in detail microcontroller interfacing techniques using the popular PIC 16F877 Work through step-by-step examples interactively using circuit simulation software, supplied as assembly source code Gain the knowledge of a wide range of peripheral devices such as keyboards, displays, sensors and drives and serial communication with other processors, memory and more Use interactive simulation software to design and test circuits. | Interfacing PIC Microcontrollers b3 BTFSC PORTC 6 button 3 GOTO bs no MOVLW 3 yes MOVWF Char MOVLW 03 MOVWF RETURN Kval bs BTFSC PORTC 7 button - GOTO rowd no MOVLW MOVWF - Char yes MOVWF RETURN Oper rowd BSF PORTC 2 select row D BCF PORTC 3 CALL One ms BTFSC PORTC 4 button C GOTO b0 no MOVLW c yes MOVWF Char MOVWF RETURN Oper b0 BTFSC PORTC 5 button 0 GOTO be no MOVLW 0 yes MOVWF Char MOVLW 00 MOVWF RETURN Kval be BTFSC PORTC 6 button GOTO bp no MOVLW yes MOVWF RETURN Char bp BTFSC PORTC 7 button GOTO done no MOVLW yes MOVWF Char MOVWF RETURN Oper done BSF PORTC 3 clear last row CLRF RETURN Char character code 0 Write display . disout MOVF Kcode W Load the code BSF Select RS Select data mode CALL RETURN Send and send code Process operations calc MOVF Oper W check for add MOVWF Temp load input op code MOVLW load plus code SUBWF Temp compare BTFSC STATUS Z and check if same GOTO add yes jump to op MOVF Oper W check for subtract MOVWF Temp MOVLW SUBWF - Temp BTFSC STATUS Z GOTO sub MOVF Oper W check for multiply MOVWF Temp MOVLW x SUBWF Temp BTFSC STATUS Z GOTO mul MOVF Oper W check for divide MOVWF Temp MOVLW SUBWF Temp BTFSC STATUS Z GOTO div GOTO scan rescan if key invalid Program Continued 126 Calculate Compare Capture Calclate results from 2 input numbers add MOVF Num1 W get first number ADDWF Num2 W add second MOVWF Result and store result GOTO out re s display result sub BSF STATUS C Negative detect flag MOVF Num2 W get first number SUBWF Num1 W subtract second MOVWF Result and store result BTFSS STATUS C answer negative GOTO minus yes minus re sult GOTO out re s display result minus MOVLW 1 - load minus sign BSF Select RS Select data mode CALL Send and send symbol COMF Result invert all bits INCF Result add 1 GOTO out re s display result mul MOVF Num1 W get first number CLRF Result total to Z addl ADDWF Result add to total DECFSZ Num2 num2 times and GOTO addl repeat if not done GOTO outres done display result div CLRF Result total to Z MOVF Num2 W get .