I have never heard of 'mov', 'djnz' and 'ret' instructions in conjunction to the PIC Baseline family. Also there is no need semicolon in front of the label. Are you using a different Assembly than MPASM or some customized macro set? It is hard to tell the exact timing of the delay routine if the instruction timing of each step is unknown. Anyway, I assume that in your macro set everything is going all right, so then the different timing is another issue. Maybe you have a WDT switched on you forget to clear? Tamas On Sun, Feb 7, 2010 at 9:57 PM, David V. Fansler wrote: > After a long hiatus from PICs, I picked up a project recently that I am > using a 12C509(A) for the first time. =A0The project is simple - when pow= ered > on check a jumper - if jumper high send 4 characters through a bit bang > serial port (9600,8,n,1), if jumper low send 2 characters through the bit > bang serial port (9600,8,n,1). =A0Then wait for the first returned charac= ter > and verify if it is what was expected. > > > > All that works. =A0As a visual indicator, I have a LED that flashes sever= al > times on power up, flashes once when sending data, and if the returned da= ta > is good it flashes several more times and the 12C509 goes to sleep. =A0If= the > returned character is not valid, it turns on for a short period of time a= nd > goes out, and again the PIC goes to sleep. =A0The problem I am having is = that > the flashing occurs at two different rates. =A0The fast rate is 50ms per > on/off cycle and the slow rate happens so in often I have not been able to > clock it, but it is about 1s per on/off cycle. =A0I am running an external > 4.00 MHz oscillator. > > > > Here is the code for the loop > > general_delay_out > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mov =A0 = =A0 =A0 delay_cntr,0ffh > > :loop_1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 nop > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mov =A0 = =A0 =A0 delay_inner, 0a0h > > :loop_2 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 djnz =A0 =A0 =A0 delay_inner, :lo= op_2 > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0djnz =A0 = =A0 =A0 delay_cntr, :loop_1 > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ret > > > > Thanks, > > > > David > > > > David V. Fansler > > s/v Annabelle > > dfansler@dv-fansler.com > > www.dv-fansler.com > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- = /* www.mcuhobby.com */ int main() { char *a,*s,*q; printf(s=3D"/* www.mcuhobby.com */ int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist