For not extremely precise timing ( but software ajustable ) I will write for you the program in 30 seconds, precisely tmr0 based routine needs 1 minute: include f628_20 include jpic628 cmcon =3D 0x07 ; disable comparator bank_1 option =3D 0b_0xxx_xxxx ; enable pull-up on port_b bank_0 var byte dip_switch is port_b_low port_b_low_direction =3D input forever loop if dip_switch =3D 0 then delay_100uS ( 10 ) ; do your job1 elsif dip_switch =3D 1 then delay_100uS ( 20 ) ; do your job2 elsif dip_switch =3D 2 then delay_100uS ( 30 ) ; do your job3 elsif dip_switch =3D 3 then delay_100uS ( 40 ) ; do your job4 end if end loop regards, Vasile http://www.geocities.com/vsurducan/electro/PIC/pic.htm On Thu, 18 Jul 2002, Wallace do Valle Barros wrote: > Hi all, > > > I need to do some applications with a time routine which is configured > by a dip switch. Where can I find or can I do a simple routine for this > type of time application? > > Example: > Dip switch with 4 bits: > > DIP | Time > ------------------------------- > 0000 | 1ms > 0001 | 2ms > 0010 | 3ms > 0011 | 4ms > =85 | =85 > > Best regards > Wallace > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body