Question?
wafa86
Posts: 44
hi
In BASIC Stamp® 2px Microcontroller (BS2PX-IC) manual was written that the Processor Speed is 32 MHz Turbo and the Program Execution Speed is ~19,000 instructions/sec. In the SX48BD (the Microcontroller of BS2PX module) datasheet was written:"Throughput is enhanced by operating
the device at frequencies up to 75 MHz" and "13.3 ns instruction cycle, 39.9 ns internal interrupt response at 75 MHz", now I am confused!!; at what speed the BS2PX module is operate on 75MHz or 32MHz, and how many insttructions per second theMicrocontroller can execute?!!!
In BASIC Stamp® 2px Microcontroller (BS2PX-IC) manual was written that the Processor Speed is 32 MHz Turbo and the Program Execution Speed is ~19,000 instructions/sec. In the SX48BD (the Microcontroller of BS2PX module) datasheet was written:"Throughput is enhanced by operating
the device at frequencies up to 75 MHz" and "13.3 ns instruction cycle, 39.9 ns internal interrupt response at 75 MHz", now I am confused!!; at what speed the BS2PX module is operate on 75MHz or 32MHz, and how many insttructions per second theMicrocontroller can execute?!!!
Comments
The PBasic program is not stored within the SX. It's stored in an external I2C serial EEPROM which operates at a clock up to about 400KHz. There's an overhead of 1 byte for each sequential read operation and each byte takes 9 clocks. A 2 byte long instruction could be read at about 14000 per second. Some instructions are only 1 byte long and a mix of 1 and 2 byte instructions could give an average speed of 19000 per second.
Countdis VAR Word
DO
IF (Countdis < 0) THEN
DEBUG "YES",CR
ELSE
DEBUG "NO",CR
PAUSE 1000
ENDIF
LOOP
I tried this code but I notice that the if statement only used when campare between unsigned numbers. Is there any techniqe I can use to do the previous code???!!!
$FFFF = -1
--to--
$8000 = -32768
-and-
$7FFF = +32767
--to--
$0000 = 0
Note that you can compare negative values using unsigned arithmetic and you can compare positive values using unsigned arithmetic, but it's in comparing positive to negative values that gets you into trouble.
If you really want to do signed comparisons, you have to first separate the quadrants (+/+ and -/- from +/- and -/+). The easiest way is by comparing the signs of the numbers like:
IF (a & $8000) = (b & $8000) THEN GOTO sameSign ' < and > will be valid
IF (a + $8000) < (b + $8000) THEN GOTO trueLess ' If opposite signs
Try these out on paper with sample values.