Problems with variable - Advise welcome


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

    Default Problems with variable - Advise welcome

    Hi
    Use PicBasic Pro

    Anybody give some advise as to setting a variable for example

    a var BYTE
    b ......

    a=0
    b=0
    c=0

    if a=1 then ...

    if b=1 then

    if c=1 then

    All this is ignored and the 'if' statements are performed even though all the variables are set to '0'. Is there something special you have to do.

    Thanks

    tracker

  2. #2
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default !!

    There´s no apparent reason to doesn´t work!

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Post the code you're having problems with. That makes it a lot easier
    for folks to help.

    Here's a simple test with 3 LED's connected to PortB pins 0-2 to see how
    it's working.

    Portb.0 -------|>|---/\/\/\--- gnd
    Portb.1 -------|>|---/\/\/\--- gnd
    Portb.2 -------|>|---/\/\/\--- gnd
    Code:
    A VAR BYTE
    B VAR BYTE
    C VAR BYTE
    
    A = 1
    B = 0
    C = 1
    
    Main:
        IF A = 1 then HIGH 0 ' PortB.0 LED on  
        IF B = 1 then HIGH 1 ' PortB.1 LED on
        IF C = 1 Then High 2 ' PortB.2 LED on
        Goto Main
    LED's on RB.0 & RB.2 turn on while the one on RB.1 stays off.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. variable problems
    By DmitriK in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th June 2008, 21:19
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. Need advise on PIC controlling a variable resistor
    By baldwics in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 16th February 2006, 20:35
  5. 2k barrier variable problems
    By khufumen in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 20th December 2004, 23:35

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