Scan time for bs2
J^3
Posts: 121
Good Morning everyone,
I read in the bs2 syntax manual that the bs2 executes ~ 4k instructions p/s.· I would like to calculate the scan time for a code but I am un certian about what the bs2 considers an instruction and what it doesn't.· Any help would be appreciated.· Thank you.· P.S.· If I am understanding this right, each instruction would take ~ 230 micro secs.
I read in the bs2 syntax manual that the bs2 executes ~ 4k instructions p/s.· I would like to calculate the scan time for a code but I am un certian about what the bs2 considers an instruction and what it doesn't.· Any help would be appreciated.· Thank you.· P.S.· If I am understanding this right, each instruction would take ~ 230 micro secs.
Comments
-Phil
Each PBasic 'keyword', like "HIGH 15", or "LOW 15", or "GOSUB", is compiled into a 'token' (an integer, basically) by the Parallax provided IDE. These tokens are then 'downloaded' into the BS2 module resident eeprom when you click "Compile". Comments are not tokenized. "Constants" are replaced by the actual value.
When your program 'runs' in the BS2, the BS2 'runtime engine' (programmed into the 16C57 PIC chip) fetches tokens from the eeprom, and uses the token to select a piece of the 'run-time' code to implement that functionality. And it can do that at about 250 uSec per instruction.
Now, some instructions have built-in time-delays to them -- like SERIN/SEROUT which take 1 mSec per character at 9600 baud, or PULSIN/PULSOUT, which have to 'wait' for the end of the commanded pulse before going on, or even "PAUSE 100", which will pause 100 mSec. Even the time to execute an IF--THEN can vary, based on if it's true or false.
This does leave as an open question this "Code" you're trying to read.