newbie...need help in a small program...

Status
Not open for further replies.

kingsden

New Member
#include<p16f877a.inc>
ORG 0X00
ADC1 EQU 0X40

MOVLW 0X27 ; 39 IN DEC
MOVWF ADC1

MOVLW 0X23 ; 35 IN DEC

SUBWF ADC1,1

END

after running the program the status bit is reading 0x1B and i am getting an message

CORE-W0014: Halted due to PC incrementing over the Maximum PC address and wrapping back to Zero

i tried keeping a CLRF STATUS after the sub operation even then i am getting status as 0x1B

why am i getting a carry and a digit carry?? can anyone please help me out....
 
You don't have enough there to make a working program - like it says it will simply keep incrementing and loop round, you need to have an actual line to prevent this - usually just an endless loop (a line jumping to itself).


Also, don't use lines like "SUBWF ADC1,1", use the correct labels from the include file - don't use 1 and 0.

Then check what subtract instructions on a PIC actual do, it's not quite what you probably think.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…