Problem 2 Signed Numbers Write the equivalent PIC18f452 data

Problem 2: Signed Numbers

Write the equivalent PIC18f452 datasheet assembly code of the following C code fragment:

int x = -10;//any value int y = 30;//any value while (x 10) {y++;} x = x + 10;}

Solution

LIST P=PIC18F452
#include P18F452.INC
PORTD EQU 0xF83
TRISD EQU 0xF95
MYREG EQU 0x50
ORG 0
CLRF TRISD
BACK BSF PORTD,0
INX X
BSF PORTD,1
INX Y
BSF PORTD,2
WHILE X<=Y
BSF PORTD,3
IF X >10
BSF PORTD,4
INC Y
BSF PORTD,5
ELSE X=X+10
GOTO BACK
ORG 0X300
DELAY MOVLW 0X19
MOVWF MYREG
AGAIN NOP
DECF MYREG, F
BNZ AGAIN
RETURN
END

Problem 2: Signed Numbers Write the equivalent PIC18f452 datasheet assembly code of the following C code fragment: int x = -10;//any value int y = 30;//any valu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site