Having problems with simple code!
I am a beginner·and need some help. I am trying to write code to accept an input and then·read a dip switch to make a pulse longer or shorter and output that on another pin. I can get the pulse to adjust but I cant get it to recieve the pulse and only fire once. Please help Im stuck!
Please see attachment.
Please see attachment.
SRC

2K
Comments
You say that you can't get the SX to receive the pulse - what is generating the pulse? Is the signal a solid 0 or +5 volts? Have you used the debugger to verify that your hardware and software is all working like you think it is? You can set a breakpoint on the first actual code line after the "CHKIN" label and then manually trigger a pulse to verify if the SX is "seeing" the input pulse.
The key to debugging is to start working at the problem a little bit at a time. Physically verify that each of the little steps you think is working is actually working. As you verify each thing, you can eliminate it from the list of ptential problems. Wherever possible, remove code and/or hardware from the thing you're trying to debug to eliminate possible problems. For example, you could use a resistor going to +5V and a switch connected to ground to create a way of manually injecting a "pulse". You could then verify that the code is doing the right thing using the debugger. If that works, and the real pulse source doesn't, then you need to figure out what aspect of the pulse source is cusing the problem.
Thanks, PeterM
Thanks for your reply. I will try that out to see if it fixes the problem Im having. For some reason it seems as if it is stuck in a continuous loop and stays in this loop. I can see that the delay loop is working I just cant get it to see the input and then run the delay routine. I will let you know what i find.
Thanks,
Dustdemon