PDA

View Full Version : if else statements, sorry im a beginner



mdb86
- 25th April 2006, 03:08
Im trying to write a program using the PIC16F84

I cant seem to figure out how to get an IF ELSE statement to work. I know how to program in c++ but i'm trying to learn how to program in assembly. Basically I just wondering how i would write a IF ELSE statement that would perform an ADDWF operation if the value in a specific F register location is > 10. Hopefully im making this clear. I would really appreciate any help.

thanks

mister_e
- 25th April 2006, 03:33
Depending how you want to work but i don't see any benefit to use any assembler in that...



VarA VAR BYTE
VarB VAR BYTE

Start:
IF VarA > 10 then
VarB = VarB + 1
ELSE
VarA = 0
ENDIF

mister_e
- 25th April 2006, 04:14
I know how to program in c++ but i'm trying to learn how to program in assembly


Once again i misread ... usually we answer to Melabs PicBasic or PicBasic not assembly...

You may use some math substraction. Once the substraction's done, check the Z or Carry/Borrow bit of the STATUS Register... Well IMHO.