To no avail . . .


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Default To no avail . . .

    Hi Everyone,
    This is my first use of a 12F675, and I used some of Bruces code, to BCD control the time period from a lookup table and it works really well. I am using his code to control LED off time, But I am trying to control on time using IF / THEN loops and the code simply ignores the IF / THEN loop as if it simply said 250. If I substitute a number in the B0 variables place it uses that number. Anyone have an idea why the IF/Then loop has no effect? I have moved it around within the code to no avail.
    Thank You
    JS
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF 
    
     PCON = %00000011       ' BOD off, No POR flag set
    DEFINE  NO_CLRWDT 1
        OSCCAL = %1111100   ' 
        CMCON   = 7	        ' disable analog comparators
        ANSEL   = 0         ' disable A/D module, all digital
        WPU.4 = 0           ' disable weak pull up on GPIO.4
        B0    VAR BYTE
        X     VAR WORD
        
        Index VAR BYTE
        
        LED   VAR GPIO.5    
        
        TRISIO = %00011111   ' RA0 to RA3 inputs for DIP switch
        
        OPTION_REG = %11111111
    
        
    
        
    Main:  
         IF (GPIO.4 = 1) THEN
      B0 = 2500
    else
      B0 = 250
      endif    
      
        Index = GPIO & $0F   ' Read DIP switch AND mask result
        LOOKUP2 Index,[200,300,400,500,600,700,800,900,1000,2000,_
        3000,4000,5000,6000,7000,8000],X
        
        
        HIGH LED
        PAUSE b0
        LOW LED
        PAUSE X
        
    GOTO Main
    
        END
        POKECODE @$3FF, $50  ' reintroduces osscal correction data
    Last edited by Archangel; - 20th January 2008 at 09:15.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Wink just a typo ...

    Hi,

    I note :

    B0 var Byte ... and further B0 = 2500 ...

    so, 255 is the maximum possible value for B0

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    I note :

    B0 var Byte ... and further B0 = 2500 ...

    so, 255 is the maximum possible value for B0

    Alain
    <h2><font color=red> THANKS! that was it !</h2></font color>
    That was a BOZO not a typo
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    [QUOTE=Joe S.;49321That was a BOZO not a typo [/QUOTE]

    Glad to see you're happy ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    That was a BOZO not a typo
    Since you're using a 12F675, how much accuracy do you need with the delay?
    If a lot of accuracy isn't needed, how about throwing a pot on a pin and using the POT command for a the delay?
    It would save you 3 pins to do other stuff with at the very least, and you can still scale the delay from a low to a high end with a simple software change.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Jeremy,
    I might do that, this device only needs to do what it does, but those extra pins could be used for more on time options like 500, 1000, or maybe the pot command might control that.
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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