Decimal delays
I'd like a delay of less than 1ms, so I tried:
SCRIPT SET DIO[0], 1 WAIT 0.1 SET DIO[0], 0 WAIT 0.1 GOTO 0 ENDSCRIPT RUN
I got the following:
Initializing PRU Speak
Illegal character '.'
Traceback (most recent call last):
File "./my_example_copy.py", line 87, in
BOTSPEAK allows decimal delays, does PRUSPEAK?
--Mark
First of all sorry for the shoddy error handling, I'm working on cleaner error messages.
The PRU Speak interpreter executes bytecode not the actual instructions. The python frontend in the userspace compiles the BotSpeak instruction and then gives the pru the byte code to execute. This is to make things faster and memory efficient. But the drawback is that I can't handle floats. So this week I'll be adding a WAITus instruction for a micro second wait. I hope that'll help :) P.S. I'm also planning for real float support once I move to the JIT architecture for PRU Speak!
SInce each assembly instruction takes 5ns, why not have a WAITns?
It's because it's hard to guarantee accuracy in terms of ns. A couple of inst here and there, you are already ~50-100 ns off.
WAIT instructions can now take uS delays. Added float tokenizing to bs_lex. Sending pull request.