One thing at a time, Tamas. Topic tag trumps.=20 And who knows, "Hy" may be post-hello-kitty "Hai" and we are just too old to appreciate a nice gesture that combines respect and familiarity. Don't tell a youngster "get off my lawn" just for the hell of it =20 >^..^< Friendly regards, Bob On Sat, Jun 22, 2013, at 03:27 PM, Tamas Rudnai wrote: > Hi Mircea, >=20 > Could you please spell "Hi" correctly? :) >=20 > Thanks, > Tamas >=20 > Sent from my iPhone >=20 > On Jun 22, 2013, at 11:57 AM, Bob Blick wrote: >=20 > > added tag. -Bob > > > > On Sat, Jun 22, 2013, at 11:42 AM, mircea2012 wrote: > >> Hy. > >> In this program i try to test compare mode using pic16f88. > >> I am not quite sure if it is OK but the code is working. > >> I set an output RB0 for 1 sec (led is ON), after that i reset that out= put > >> RB0 (led is OFF) for 1 sec. > >>> From my calculations : f =3D 4MHz / (4 * 8 * 65536) =3D 2Hz > >> T =3D 1 / 2Hz =3D 0,5 which means that the led is on twice per sec. > >> But in program i use variable counter to increase the delay, so led is= on > >> for 1 sec and off - 1 sec. > >> > >> > >> #include > >> > >> #pragma DATA _CONFIG1, _EXTRC_CLKOUT & _WDT_OFF & _LVP_OFF > >> > >> unsigned int counter =3D 0; > >> > >> void interrupt() > >> { > >> if((pir1 & 0x01) && (pir1 & 0x04)) > >> { > >> clear_bit(pir1, 0); > >> clear_bit(pir1, 2); > >> counter++; > >> if(counter =3D=3D 2) > >> { > >> ccp1con =3D 0b00001001; > >> } > >> else if(counter =3D=3D 4) > >> { > >> ccp1con =3D 0b00001000; > >> counter =3D 0; > >> } > >> } > >> } > >> > >> void main() > >> { > >> trisb =3D 0xf0; > >> portb =3D 0x00; > >> tmr1h =3D 0; > >> tmr1l =3D 0; > >> ccpr1l =3D 0x60; > >> ccpr1h =3D 0xea; > >> cmcon =3D 0x07; > >> t1con =3D 0b00110001; // prescaler =3D 8 > >> intcon =3D 0b11000000; > >> pie1 =3D 0b00000101; > >> ccp1con =3D 0b00001000; > >> while(1) > >> { > >> > >> } > >> } --=20 http://www.fastmail.fm - The way an email service should be --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .