Apparent code size problem


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer View Post
    Try this for the one above:
    Code:
     
    IF ErrCnt > 1 or FlagResult > 0 THEN GOSUB Houston
    -------------------------------------------------


    And try this for the one above:

    Code:
    IF OhmCheck = FAILED or FlagResult > 0 then GOSUB Houston
    And try this separately:

    Code:
    IF OhmCheck = FAILED THEN
        ErrCnt = ErrCnt + 1     
    
        IF ErrCnt = 1 then 'first time gets a pass for a recheck
            Device = DISPLAY
            GOSUB SetCtrl
            LCDOUT $FE,1,"Chk Dckbill conn"
            LCDOUT $FE,$C0,"then retry test"
            PAUSE 1000
        else
            gosub Houston 
        endif
        
    ENDIF
    
    
    IF FlagResult > 0 THEN GOSUB Houston
    Question: Do you set ErrCnt = 0 before the program starts running, or it gets some values from somewhere else?

    In your code, it seems that it must be set to zero at initial power up before coming to "IF OhmCheck = FAILED THEN" condition.

    Question: FlagResult is a hardware flag. So it can be 1 or 0 only, right? If yes, then why not use IF FlagResult = 1 instead of FlagResult <> 0 ?

    FlagResult is a hardware flag, but it is a set of BIT flags so it can have a result other than 0 or 1.

    Also, as Jerson said, we should see Houston subroutine.

    May be there is something in it that makes things messed up.


    --------------------------------

    Both of those examples are fundamentally the same. The difference being your use of the IF without the ENDIF, which some languages (like PBP) allow.
    I did try it though.

    Yes, ErrCnt is set to 0 before usage.

    FlagResult is a hardware flag, but it is a set of BIT flags so it can have a result other than 0 or 1.

    The subroutine Houston uses Select Case to decode FlagResult and displays the appropriate error message. It does not return from there but goes into a continous loop because errors that cause Houston to be called are considered critical problems with either the instrument or the site being tested.

    I may not have made myself clear in the original post, the problem does not occur because the code in question is run (the program never gets that far). The problem occurs when the first piece of code is replaced by the second.

  2. #2
    sinoteq's Avatar
    sinoteq Guest


    Did you find this post helpful? Yes | No

    Default Try the dummy variable fix

    This is what I had, I changed in one place and it died in another. If you check the asm file that you have on the NOT working program it is easy to see. Just look at the end address for each bank and most likely you will see Byte0 of a Word variable there. Byte1 will be in then next bank and this messes up all the RAM area for you even if you don't use that variable in the start of your program.

    M

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. problem with my code
    By civicgundam in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd February 2008, 01:52
  4. Setting code size boundaries
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th March 2007, 20:11
  5. Servo Code problem
    By ALFRED in forum General
    Replies: 1
    Last Post: - 2nd March 2006, 03:30

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