To no avail . . .


Results 1 to 6 of 6

Threaded View

  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.

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