Hi Gary,
Thanks again for your input. It was very helpful. I am still trying to get my densifier to change the grinder time depending on the position of the high/low switch. The ladder code you gave me on the other posting didn't work. There is just too much stuff going on at the same time and it caused other problems. I got the TBASIC code to work. Well, mostly. I used the existing ladder code, but added some custom TBASIC to it. See the attached ladder code. The problem is that no matter what I type in TBASIC, it still saves that last value when you turn the switch on. In other words, when you go from Low to High it runs the Low timer one more cycle and then runs the High timer from then on. I tried changing the timer to 0. Clearing the IO for that timer and refreshing. It still does it. What is weird is that the I/O table shows the correct values (I added pauses in for each step), but the simulator still holds that timer value one last time. Here is what I wrote:
SetTimerSV 9,0
CLRIO GrndrTmr
Refresh
IF TestIO(SWHigh)
Then SetTimerSV 9,0
CLRIO GrndrTmr
Refresh
Else SetTimerSV 9,0
CLRIO GrndrTmr
Refresh
ENDIF
IF TestIO(SWHigh)
Then CLRIO GrndrTmr
Refresh
SetTimerSV 9, GetTimerSV(15)
Refresh
Else CLRIO GrndrTmr
Refresh
SetTimerSV 9, GetTimerSV(16)
Refresh
ENDIF
RETURN
I know it has a lot of overkill in it, but it still didn't work. I am new to this so I am probably doing something wrong. 9 is GrndrTmr. 15 and 16 are the Low and High timers. Thanks again for your help. Take care.
Jeff