Alright I'v got this bit of code here that compiles alright but some thing isnt working because when I hook up my pic16f88 it dose nothing but sit there. Im programing with IC-Prog 1.05D and wish to use the internal timing crystal. Code: program LED_Patterns sub procedure pNightRider 'Night Rider LED Pattern dim x as byte dim vNightRider as byte vNightRider = $00000001 for x = 0 to 5 step 1 vNightRider = vNightRider << vNightRider PORTA = vNightRider next x for x = 5 to 0 step -1 vNightRider = vNightRider >> vNightRider PORTA = vNightRider next x return end sub Main: dim Pattern as byte 'Variable to store current pattern TRISA = 0 'Configure pins of PORTA as output TRISB = %00000001 'Configure first pin of PORTB as input and the rest as output INTCON = %10010000 'Enable Interrupts Pattern = 0 'Set it to 0 when the pic starts while true 'Main Loop if Pattern = 0 then pNightRider else if Pattern = 1 then 'add code here end if end if wend end.
Im gonna have to let someone else handle this. I only know MPASM. From the look of this, it seems like there is no timing for the pattern, and the loop would be going so fast that all the LEDs would appear to be on all the time. Also, do you have MCLR held high with a pull-up resistor when operating?
I'm not too familiar with the 16F88, but usually PORTA is assigned to AD conversion and the comparator. Be sure to turn off all AD inputs on PORTA as they are not disabled at power up. See ADCON1 and CMCON.
Oh crap that could be it. I will check the AD register and disable them. I'v disabled the MCLR fuse just so I don't have to pull it high. I have put a Delay_ms(500) under the PORTA = vNightRider (both of them). I thought this was the issue as well but now I'm thinking its the AD or comparator.
No I'm just using a basic compiler and there are several flavors of compiler for normal pics (c, basic, pascal). http://www.mikroelektronika.co.yu/english/download/#compilers
To use the internal oscillator, you have to set the OSCCON register. Something like: OSCCON = 01110000 'Set internal Osc to 8MHZ Double check the datasheet, but it should work for your PIC (It works for 16F819) MAKE SURE the CONFIG1 register has the Fosc values correctly set to 101 or 100 to select the internal oscillator. You can read up on these registers in Chapter 15 (Special Features of the CPU) of the Datasheet.