It seems writing code is a perishable skill, since I haven't written anything in a long time with the combination of training a new new nurse,(that's a long bad story) I was simply not able to think clearly.
I have some code I am happy with and it mostly works, the strange thing is, the baud rate for the pst on 115_200 writes gibberish but the 57_600 writes normal. Don't know if that's because I am working through a usb 3 or some other reason I don't understand.
The other strange thing is when I use clkfreq/1000 + cnt and I hold the button down for a secondish I only get about 60 counts instead of a 1_000, not that big of a deal I just thought clkfreq / 1000 + cnt would pause every 1ms.
Code: Select all
_xinfreq = 5_000_000
_clkmode = xtal1 + pll1x
PushButton = 0
LED = 1
Led_A = 2
pst : "Parallax Serial Terminal"
PUB ButtonLed | counter
IF ina[PushButton] == 0
counter := 0
waitcnt(clkfreq/200 + cnt)
repeat until ina[PushButton] == 1
waitcnt(clkfreq / 10 + cnt)
pst.Str(String("counter = "))
if ((counter > 5) and (counter =< 10))
waitcnt(clkfreq + cnt)
if ((counter =< 5) and (counter > 2))
waitcnt(clkfreq/4 + cnt)
In the above code I use clkfreq/10 + cnt because it made the counts easier to work with but I did try 1_000 and the count is only about 60. NO big deal I can just see how the count relates to Lisa's eye movement and write the code based on what ever numbers fit best, just wanted to be able to break it down into smaller increments to give me more room to work with for my windows.