Hi Robert, On 02/01/2014 10:34, Robert Dvoracek wrote: > Okay, let's try plain text this time. yes, plain text is the only possibility. Usefull also if you repost with al= l other text because some people may haven't read it. And dont like to dig in= to old messages. > > CODE BEGINS HERE > > #include p10f200.inc > > ; set up the chip and do other stuff This, a lot of time, can be rilevant, also for a small 10F. > > Delay5m > > ; do the things > ; 6 instruction overhead in here which is irrelevant to the beeping Pay attention to this: YOU think that is irrelevant! But You are asking us = to find a relevant problem in the code before and after. Never do this unless = you KNOW what are you doing. In this case the instruction are VERY RELEVANT because are inside a main lo= op and each instruction can be "long" 1 or 2 us so the code that we can not se= e can be of 6 to 12 us! > > decfsz TimerL,f You are naming a variable with a name very close to PIC internal register, personally dont like it because e small typo can lead to subtle error! > goto Delay5m > > btfss Beep,DoIBeep > goto $ + 3 NEVER do this! Ever use labels with gotos. This kind of use is only for rare occasions, dont waste ;-) > movlw LED_MASK ; Sound a tone to remind the user tha= t > xorwf GPIO,f ; the door is open. > > decfsz TimerH,f > goto Delay5m > > movf TimerE,W ; Sound tone during 6/256 TimerE iter= ations > andlw b'11111000' ; Throw out the lower 3 bits. > xorlw b'11111000' ; Compare the upper 5. > btfss STATUS,Z > goto $ + 3 > movlw 1 > xorwf Beep,f > > > decfsz TimerE,f > goto Delay5m > > decfsz TimerW,f > goto Delay5m > > ; end of the loop =20 Waiting for the entire code... I remember you that with the Simulator of MP= Lab 8 you can simulate ad measure accurately this code. Bye Nicola --=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 .