You have a slight problem here.
In it's simplest for this will delay (Phase-Shift) the output for a period in mS equal to the variable PortDelay
PortDelay var Byte
PortFlag var Bit
PortStatus var Bit
PortDelay=50
PortFlag=0
loop:
PortStatus=InputPin
If PortStatus < > PortFlag then
PortFlag=PortStatus
Pause PortDelay
OutputPin=PortFlag
endif
Goto Loop
Now this is fine for slow delays in mS, but switching to uS, you'll find that your accuracy is hampered by your own PIC's processing speed adding a few uS here and there. There's no way that the same PIC that is doing your number-cruching and LCD Displays will have time to perform a background task that needs to accurately time-delay a Pulse in low uS counts. To do this digitally in uS without introducing processing delay errors looks like a job for a dedicated Programmable Delay Line....
Bookmarks