Quote Originally Posted by mbw123 View Post
Hello, I am using an 18F4550 and I am trying to get it to read a digital input and turn on a LED when it is on. For some reason there is a five second pause when I trigger the pin. When I reset the PIC and plug it back in, there is no pause. The pause only occurs when I trigger the pin. The code I am using is below.
It may be important to note that I am using about 10V with a 22K resistor for input, if that has anything to do with it.
Code:
-----------------
rts var porta.2 : cts var portd.3 : led var portd.2 : input rts : output cts
output led : ADCON1 = %00001111 : low led : low cts
main:
while rts = 1
high led
wend
low led : goto main
--------------------
Can anyone help?...skimask?
Thanks,
-Mike
Is the 22K resistor in series with the pin or is it across Vdd or Vss or what?
Also, write a quick program that turns the LED on and off for 1 second each. This will make sure your PIC isn't running on the internal/backup/failsafe 37khz oscillator for some silly reason.
(4mhz / 62.5khz (desired freq vs actual freq) = 64............64 x 72ms (power up timer) = 4.6 seconds...the math adds up fairly well).