Debug in + Floating pin = stop program execution?
I have a picbasic program that with some intermediate testing seemed to work well, however, when the serial interface cable was removed, the program would intermittantly halt, where the debigin command is:
A snip of the code is below:
Code:
DEBUGIN 10000,runmode,[WAIT("x"), TriggerChar] ' TriggerChar = X
If TriggerChar = "x" then GOTO Setup
runmode:
SerOut So, N9600, [27,"[2J"] ' Clear Terminal Screen ' Output
SerOut So, N9600, ["Entering Run Mode, Disconnect Programming Cable."] ' Output
pause 500
What happens is when the serial cable between the pic pcb and PC is removed, the program will stop around the debugin command, however the debugin pin is floating (only an 18k resistor in series with the DB9 pin socket.
Tying the pin low (via another resistor) seems to correct the issue, however scoping the pin without the resistor shows less than 5mv fluctuation on the pin - is this enough to cause the issue?
Should i tie the pin low with a 47k resistor or is my problem somewhere else?
Do i also need to tie all unused pins low, or is it simply ok to have them set as outputs?