if else statements, sorry im a beginner


Closed Thread
Results 1 to 3 of 3
  1. #1
    mdb86's Avatar
    mdb86 Guest

    Default if else statements, sorry im a beginner

    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

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Depending how you want to work but i don't see any benefit to use any assembler in that...

    Code:
    VarA    VAR BYTE
    VarB    VAR BYTE
    
    Start:
        IF VarA > 10 then
                VarB = VarB + 1
            ELSE
                VarA = 0
            ENDIF
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Doh!

    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.
    Last edited by mister_e; - 25th April 2006 at 03:20.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Multiple IF-THEN statements
    By DavidK in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th June 2007, 18:28
  3. Proton Commands & statements
    By Lotondo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th November 2006, 23:37
  4. time for PBP statements
    By fnovau in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 25th October 2006, 19:42
  5. If - then statements
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 18th May 2006, 22:57

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts