if-then statements


Results 1 to 5 of 5

Threaded View

  1. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi C.C.,
    this might be an opportunity to use select case.

    I noticed you are using IF THEN to direct functions for each state or your PortA.2 inputs, why not use ELSE ?
    Code:
    main:
    If PortA.2 = 0 then
    gosub waterok
    ELSE
    Gosub Waterbad
    if PORTA.6 = 1 then ' assumes you have pulldown resistor
    GOSUB tempdown
    if PORTA.7 = 1 then 'assumes you have pulldown resistor
    GOSUB tempup 
    ENDIF
    endif
    endif
    goto main
    waterok:
    lcdout $fe, $c0+13, " OK"
    return
    
    waterbad:
    lcdout $FE,$c0+13, " NASTY"
    return
    
    tempdown:
    
    lcdout $fe, $80+0, "TEMP DOWN "
    RETURN
    
    tempup:
    
    lcdout $fe, $80+0, "TEMP UP "
    RETURN
    END
    HTH
    JS
    Last edited by Archangel; - 25th August 2007 at 08:00.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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 : 0

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