Is this a valid statement?


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dbachman View Post
    for digit = 0 to 6
    lookup digit,(4,5,9,10,6,2,3), portb

    I know you can put the number in a var but can you "stick" on portb this way?

    Thanks, Don
    Yes, it will work (TRISB = 0)
    Also,

    READ (Temp DIG X),PORTB
    Or
    POT Pin,255,PORTB
    or
    ADCIN 0, PORTB


    they all work.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  2. #2
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Okay, I feel like a dolt, but at least I learned something today. Thanks Sayzer.

  3. #3
    Join Date
    Oct 2008
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Thanks guys, I haven't tried it yet but I will here in the very near future.

    Don

  4. #4
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Is this a valid statement?

    Can anyone tell me why this does not work:

    if var8 = 1 then goto beper : J = 3

    The if statement works but J does not = 3 ?

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Is this a valid statement?

    The J=3 statement isn't executed when VAR8=1 because you're telling to jump to beper.

    If you want to set J=3 when the IF statement is true then
    Code:
    IF var8 = 1 then
      J=3
      Goto beper
    ENDIF
    or simply move J=3 to after the beper label in your program.

    /Henrik.

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: Is this a valid statement?

    You are exiting the code and jumping to a label "beper". The statement j=3 is never getting executed the way you have written it. If "beper was a subroutine (ie GOSUB beper) then it would be returned to after executing and, set j=3 as the next statement.
    Dave Purola,
    N8NTA
    EN82fn

  7. #7
    Join Date
    Mar 2008
    Posts
    59


    Did you find this post helpful? Yes | No

    Default Re: Is this a valid statement?

    Thank you, that fixes my problem.

Similar Threads

  1. 16F883 and Problems with HIGH statement
    By aaanekre in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th October 2009, 01:09
  2. END Statement
    By jderson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th November 2008, 14:48
  3. SERIN AND SEROUT PROBELM USING 16f690 PIC
    By Charles in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 18th January 2007, 03:59
  4. Is "PAUSE 0" a valid command
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th July 2006, 16:39
  5. getting around the basic IF - THEN statement
    By dw_pic in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th February 2006, 14:10

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