More IF_THEN dumb questions.


Closed Thread
Results 1 to 12 of 12

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Since you have only 8 outputs, why not using a loop test and branch to different procedure...

    something like this...
    Code:
    MyInput  var Byte   ' contactor input
    State    var bit[8] 'state of each input
    TestLoop var byte
    
    Start:
        MyInput = PORTA
        TestLoop = 0
    
    DoContactorTest:
        State[TestLoop] = Myinput.0[TestLoop]
        
        If state[testloop] = 1 then finishorno
        Branch TestLoop,[relay1,relay2,relay3,relay4,_
                         relay5,relay6,relay7,relay8]
        FinishOrNo:
        TestLoop = TestLoop + 1
        If Testloop<=7 then DoContactortest
        goto start
        
    relay1:
           ' Do the according stuff
    
        goto finishorno
    
    relay2:
           ' Do the according stuff
    
        goto finishorno
        
        '
        ' same for the other
    Last edited by mister_e; - 19th February 2005 at 19:06.
    Steve

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

Similar Threads

  1. Olympic Timer
    By Melanie in forum Code Examples
    Replies: 47
    Last Post: - 17th September 2008, 19:46
  2. Two quick (and elementary) questions.
    By scorpion990 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th June 2008, 23:03
  3. A few 12F683 questions
    By dhouston in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th May 2008, 03:54
  4. Usart Questions
    By shawn in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2008, 01:17
  5. Still new to PicBasic - i2c questions
    By cometboy in forum mel PIC BASIC
    Replies: 4
    Last Post: - 13th November 2006, 18:27

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