Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16f vs 18f

Status
Not open for further replies.
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 :D

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.
 
OK, took a bit of finding (as it was 2008), but here's TUT3.3 for an 18F2550 - the offending line was simply replaced by BTFSS STATUS, 0 - although it should really be BTFSS STATUS, C
 

Attachments

  • tut3_2.asm
    10.6 KB · Views: 169
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. ;)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top