Hi, Touch, thanks for the code, it works. But how can I implement it in 1M Hz. I know how to calculate the appropriate delay cycle for the timing. But how to determine the value of counter? TIMEOUT? in order for it to work in 1MHz? And I also have another problem. I tried by using BIT7, yeah it work perfectly. But when I change to other BIT, be it BIT0, 1,2,3,4,5, or 6, all are not working. Just BIT7 is working. I was scratching my head when this problem pops up and this shouldnt be happened in theory lol. It is really appreciated if you can give some comment