> I started to work on a project that needs counting pulses and turn led on > and off > on cretin time. > this is the data > 01010101010101010101010101010100001010101010101010101 > on count of 10 I should turn the led on after 0000 on 5 I should turn the > led off. The following algorithm should do it, I think: define flag, clear flag to start with read input on any '1' set the output port for the LED and clear the flag else read input if following input = '0' then increment the flag compare the flag with '5' as long as < 5 goto read input when flag =5 then: clear the flag, switch off the LED goto read input. I guess that you will be able to transalte this in assembler. If not you have to wait till I can find the time to do it. Henk - VK2GWK http://www.users.bigpond.com/tobbe/