Thanks Sougata, I changed that bit and now it works as expected.
A single bit keep me puzzled half week, you gotta love pics...
Here is the working example, so others can learn too:
I commented out the OPTION_REG because the program worked ok with and without it. Of course the serouts can be removed, I use them to know where the program is.Code:@ device pic16F628A, intrc_osc_noclkout, wdt_on, mclr_off, protect_off DEFINE OSC 4 trisb =%11111111 trisa =%00000000 cmcon =%00000111 'Comparators Off vrcon =%00000000 intcon =%10001000'interrupts enable // was %10101000 'OPTION_REG =%11010001 but1 var PORTB.4 but2 var PORTB.5 ledwork var PORTA.0 led1 var PORTA.1 led2 var PORTA.2 led3 var PORTA.3 rs var PORTb.2 conta var byte porta=0 portb=0 on interrupt goto interrupcion SerOut rs,2,[" ",10,13] SerOut rs,2,["Begin",10,13] LOOP: SerOut rs,2,["Loop",10,13] for conta=0 to 255 step 16 'working led rise routine pwm ledwork, conta, 10 next conta high ledwork for conta =0 to 10 pause 10 next conta low led1 'set button status leds off low led2 low led3 goto loop end disable interrupcion: SerOut rs,2,["Interrupt",10,13] intcon.0=0 intcon.1=0 intcon.2=0 if but1=1 then but1=0 high led1 SerOut rs,2,["Set",10,13] endif if but2=1 then but2=0 high led2 SerOut rs,2,["Mode",10,13] endif high led3 resume enable
Thanks to all for the help provided
Pablo





Bookmarks