16f vs 18f

Fairly obviously you should NEVER be using 'BTFSS 3,0', utterly pointless, confusing, and non-portable - use the correct mnemonics as you're supposed to (which makes the code 'portable-ish' as well.
 
Hi Nigel

It comes from your Tutorial 11.1 which converts the NumL and NumH to decimal.
Lb1:
addwf Ones,f
decf Tens,f
btfss 3,0
goto Lb1

How would you change this to work.
 
I coded as BTFSS STATUS,Z ; or C etc. ( always used uppercase for some reason ...)
<3 asm.
 
Hi Nigel

It comes from your Tutorial 11.1 which converts the NumL and NumH to decimal.
Lb1:
addwf Ones,f
decf Tens,f
btfss 3,0
goto Lb1

How would you change this to work.

As the comments in the code explain, that routine was downloaded from the PICList

I'm pretty sure I've got a version somewhere that I converted for the 18F series though?, I'll see if I can find it tonight.
 
I got it sorted out after a battle. I used the BTFSS STATUS,C but it would not register the overflow at the correct time.
The decf also affects the overflow bit C. So I swopped the addwf and decf around and its working now.

Lb1:
decf Tens,f
addwf Ones,f
btfss STATUS,0
goto Lb1
 
Nice that they have branch instructions. However, nothing beats having a compare, jump if not equal (cjne) like a good ol' 8051.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…