dannyelloko20
Newbie level 5
- Joined
- Mar 25, 2015
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 65
Hi there again, I have another project and is your feedback is needed at this point. This is what I need to do: " Read the 4-bit Switch value and then multiply the switch value by the decimal number 100 ( D’100’). Display the results on the LEDs. Must use a loop counter (“Count”) to implement this Lab. Use the literal D’100’ to set the “Count” variable and each time thru the loop add the switch value to the accumulated “SUM”. Each time thru the loop the “Count” is decrement and when you reach 0, you are done. Use REG1 for the MS byte and REG0 for the LS byte of the SUM. When S17 is a logic “0”, display the LS byte on the LEDs and when S17 is a logic ‘1” display the MS byte.
This is what I have so far and I think it needs some debugging. I would appreciate your feedback.
PD: Library for PIC16F84A is included in my program. Thank you!
This is what I have so far and I think it needs some debugging. I would appreciate your feedback.
Code:
BSF STATUS,RP0
MOVWF TRISB
BCF STATUS,RP0
MOVWF PORTB
LOOP MOVLW 0x5A
MOVWF REG0
MOVLW 0x39
BTFSS PORTA,RA0
ADDWF REG0,W
BTFSC PORTA,RA0
COMF REG1,W
GOTO DONE
BTFSC PORTA,RA0
ADDLW 0x01
BTFSC PORTA,RA0
ADDWF REG0,W
MOVWF PORTB
GOTO LOOP
DONE END
PD: Library for PIC16F84A is included in my program. Thank you!