Apparent code size problem


Results 1 to 11 of 11

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by eetech View Post
    ...

    Code:
    IF (OhmCheck = FAILED) or _  	' resistor out of tolerance or
        (FlagResult <> 0) then                 ' hardware flag  
        GOSUB Houston
    ENDIF
    Try this for the one above:
    Code:
     
    IF ErrCnt > 1 or FlagResult > 0 THEN GOSUB Houston
    -------------------------------------------------
    Quote Originally Posted by eetech View Post
    ...
    Replace it with this one and it does not work:
    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
       ENDIF
    ENDIF
    IF (ErrCnt > 1) or (FlagResult <> 0) THEN 
       GOSUB Houston
    ENDIF
    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 ?


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

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


    --------------------------------
    Last edited by sayzer; - 26th July 2007 at 10:00.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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