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




Bookmarks