You could try changing this gosub to a goto ReadSensor.if calFlag = 0 then
goto CalSensor
else
gosub ReadSensor
endif
You could try changing this gosub to a goto ReadSensor.if calFlag = 0 then
goto CalSensor
else
gosub ReadSensor
endif
Hi,
Without looking at the PIC's datasheet I think that the problem might be with the following line
ADCON1 = 255 ' Make everything digital (no analog)
Don't you need to define PORTA.0 as analog?
Robert
"No one is completely worthless. They can always serve as a bad example."
Anonymous
Hi,
Just a thought and question:
Are you sure that it is the PIC that stops? I've never used the MCS Debugger but is it possible that IT is either stopping itself (so that you THINK the program has stopped) or perhaps IT is actually stopping the PIC? Have you tried running it without the ICD?
And, what others have said: ALL subroutines to which you jump with a GOSUB must, at some point, end with a RETURN or bad things will happen. I haven't looked that close at your code but perhaps you've just been "lucky" that it works and that after three minutes there's been exactly the amount of GOSUBS without RETURN to make the stack tip over. I don't know, just thinking out loud.
/Henrik.
Hi All!
Again my sincere thanks to everyone! For Robert, the whole "system" is digital and there is no analog. The sensor only puts out digital information. Yes, it appears that the "Gosub" where Jerson located it was the error! Changed it to a "goto" and now everything runs longer than 3 minutes! FYI, the PIC never stopped running as Mclk would continue to change just the "FromSensor" would stop changing. So Henrik you were right (as usual!) I had just been lucky. By the way, I put everything on a small board, added a bunch of capacitor (probably overkill) so at the input and output of the TXB0101 there are a 470mf, 100mf tantalum, 01 ceramic, and on the bottom of the board, a 1mf tantalum on the input and output of the MCP1700-3002E voltage regulator! Best to all, Ed
Bookmarks