Maheen_Mazhar
Newbie level 6
Hi
I have just started learning PIC18 assembly language programming. I tried a simple code in MPLAB and it was successfully compiled and executed. By observing the values at the register it was confirmed.
But when I try to run the same code on Proteus, I get errors.
The program is made to turn LEDs 'ON' one by one, connected at PORTD.
At the end all 8 LEDs should be lit.
The code is:
PORTD EQU 0xF83
TRISD EQU 0xF95
ORG 0h
CLRF TRISD ;make PORTD an output port
BSF PORTD,0 ;bit set turns on RD0
NOP ;delay before next one
BSF PORTD,1 ;turn on RD1
NOP
BSF PORTD,2
NOP
BSF PORTD,3
NOP
BSF PORTD,4
NOP
BSF PORTD,5
NOP
BSF PORTD,6
NOP
BSF PORTD,7
NOP
END
In Proteus, when I click BUILDALL the following errors are encountered:
Error: Illegal opcode (TRISD)
Warning: found label after column 1 (CLRF)
Error: Illegal opcode (PORTD)
Warning: found label after column 1 (BSF)
I have just started learning PIC18 assembly language programming. I tried a simple code in MPLAB and it was successfully compiled and executed. By observing the values at the register it was confirmed.
But when I try to run the same code on Proteus, I get errors.
The program is made to turn LEDs 'ON' one by one, connected at PORTD.
At the end all 8 LEDs should be lit.
The code is:
PORTD EQU 0xF83
TRISD EQU 0xF95
ORG 0h
CLRF TRISD ;make PORTD an output port
BSF PORTD,0 ;bit set turns on RD0
NOP ;delay before next one
BSF PORTD,1 ;turn on RD1
NOP
BSF PORTD,2
NOP
BSF PORTD,3
NOP
BSF PORTD,4
NOP
BSF PORTD,5
NOP
BSF PORTD,6
NOP
BSF PORTD,7
NOP
END
In Proteus, when I click BUILDALL the following errors are encountered:
Error: Illegal opcode (TRISD)
Warning: found label after column 1 (CLRF)
Error: Illegal opcode (PORTD)
Warning: found label after column 1 (BSF)