aless2056
Member level 1
Guys, I'm starting with assembly programming and I have a lot of doubt on how to deal with 16 bits, 2 bytes.
I have the code below, how this code would be if the variables Process, Setpoint and PWM were to have an example number up to 1024, instead of 256.
I have the code below, how this code would be if the variables Process, Setpoint and PWM were to have an example number up to 1024, instead of 256.
Code:
CLRWDT
MOVF PROCESS_KW,W
SUBWF SETPOINT,W
BTFSC STATUS,Z
GOTO EXIT
MOVLW .5
SUBWF PROCESS,W
BTFSS STATUS,C
MOVLW .0
SUBWF SETPOINT,W
BTFSC STATUS,Z
GOTO EXIT
BTFSS STATUS,C
GOTO PWM_DEC
MOVLW .5
ADDWF PROCESS,W
SUBWF SEPOINT,W
BTFSC STATUS,Z
GOTO EXIT
BTFSC STATUS,C
GOTO PWM_INC
GOTO EXIT
PWM_DEC
MOVLW .0
XORWF PWM,W
BTFSC STATUS,Z
GOTO EXIT
DECF PWM,F
GOTO EXIT
PWM_INC
MOVLW .255
XORWF PWM,W
BTFSC STATUS,Z
GOTO EXIT
INCF PWM,F
GOTO EXIT
EXIT
Last edited by a moderator: