Hi there, I'm working on a project for school and it is kinda confusing so I'm here desperately for help.
Assignment: "Connect PORTB to the 8 LEDs and PORTA to switches S10 to S 14, with S14 the MSB. Read the Switch value and then multiply the switch value by the number five (5). Display the results on the LEDs. "
I came up with my code and this is what I have so far:
I would appreciate your feedback. Thanks!!!
Assignment: "Connect PORTB to the 8 LEDs and PORTA to switches S10 to S 14, with S14 the MSB. Read the Switch value and then multiply the switch value by the number five (5). Display the results on the LEDs. "
I came up with my code and this is what I have so far:
Code:
#include GENERAL.h ; PIC library
COUNT EQU 0x05
SUM EQU 0x48
; ===========================================================
__CONFIG 0X3FF2 ;This is the control bits for CONFIG register
ORG 0X0000 ;RESET or WDT reset vector
GOTO START
ORG 0X0004 ;Regular INT vector RESERVE THIS SPACE. DON'T USE IT
RETFIE
START BSF STATUS,RP0
MOVWF TRISB
BCF STATUS,RP0
MOVWF PORTB
MOVLW 0x05
MOVWF COUNT
MOVLW 0x00
MOVWF SUM
MOVF PORTA,W
LOOP ADDWF SUM
DECFSZ COUNT,0
GOTO LOOP
MOVF SUM,0
MOVWF PORTB
END
I would appreciate your feedback. Thanks!!!