Forums

BasicX-24p vs. OOPic

Started by Mario Loeffel November 15, 2005
I have just recently discovered the BasicX-24p and I'm wondering if
anyone knows how it compares to an OOPic II+ performance wise.

I currently have a system implemented on the OOPic that executes the
following tasks:

- Communication over I2C with a motor controller
(1 x 16 bit write & 1 x 24 bit read per loop)
- 4 channel, 10 bit ADC
- 8 bit PWM output
- Serial communication (async. output of 2 x 16 bits)
- Handling of user inputs (3 switches and LEDS, event based)

When the OOPic runs those tasks in a loop, the maximum execution
speed is about 2-3 Hz.

Has anyone implemented anything alike on the BasicX 24p, and if so,
what execution speeds did you get?

Thanks,

Mario


I do not personally have the processor speed comparisons between the
hardware, but I have done some of the same tasks, but not all of them
together. It seems to me that it would be a good 10x faster that that
on the BX, but I am not sure. Others here are more sophisticated than
I in these matters. You should try out the most time consuming
routines and see what you get by comparison.

-Tony


--- In basicx@basi..., "Mario Loeffel" <factor_s@y...> wrote:
>
> I have just recently discovered the BasicX-24p and I'm wondering if
> anyone knows how it compares to an OOPic II+ performance wise.
>
> When the OOPic runs those tasks in a loop, the maximum execution
> speed is about 2-3 Hz.
>
> Has anyone implemented anything alike on the BasicX 24p, and if so,
> what execution speeds did you get?

I don't have any definitive numbers for you. In fact perhaps you could
come up with some comparisons yourself. However based on my knowledge
of the two architectures and performance of the underlying chips, my
guess is that the BX-24P is on average 10-50 times faster.

I have a robot controller loop that executes around 50 times a second
and uses several tasks for sensor input including buttons and IR line
detection. And I don't think this is even full speed as I have several
delays built-in.

Mike




> based on my knowledge of the two architectures and performance of
the underlying chips, my guess is that the BX-24P is on average 10-50
times faster.

OOPic is an Object Oriented Language that appeals to people that want
to get a task operational while someone else tinkers with the more
detailed code. That seems to be pretty high level, thus it is likely
to cause a slowdown due to inefficencies in the software.

BasicX's version of Basic is able to mimic some of the features of an
Object Oriented Language, but you will have to create your own
objects from a lower level of language. So, you gain speed and
knowledge. Of course this means a learning curve to get going.

To really compare hardware, everything should be written in each
items assembler with the frequency clock. And even then, someone
will 'cry foul' because the nature of the task can make one piece of
hardware look better than another.

I guess what I am saying, is that the 10-50 times faster is a
subjective comparion, but predicts that you will notice some increase
in speed.

On the other hand, if you want to just have the fastest machine on
the block, there are 32bit RISC processors available [without Basic
support]. It is all a game of apples and oranges. Have you ever
tried to compare the value of two used cars? I smell someone's brain
frying.


Of course there are hardware specific differences underlying and I
agree that an assembler comparison would be the "cleanest" solution
for a comparison of basic operations. Unfortunately the OOPic does
not offer that option and you're strapped to the OO-paradigm.

While browsing through the Basic-X website, I came across a statement
saying that the claimed 82,000 BIPS were based on the instruction a =
a + 1. So I quickly implemented the same on the OOPic, which resulted
in about 140 BIPS - over 500 times less than the BasicX.

Of course that alone won't tell anything about performance in more
complex operations such as timed I2C routines or serial
communication. That's why I asked for benchmarks in specific areas,
such as AD conversion and serial transmission.

A simple program on the OOPic for example, reading a 10 bit AD
converted value and sending it out through async. serial at 9600
baud, runs at about 20 Hz.

Example pseudo code:

do
serial.send(adc.value)
loop According to the BasicX docs there's a function called "ADCToCom1".
How fast is that one for example? How many 10-bit values does it
stream through a serial connection at 9600 baud per second?
--- In basicx@basi..., "G. Kramer Herzog" <hwanghetw@y...>
wrote:
[]


--- In basicx@basi..., "Mario Loeffel" <factor_s@y...> wrote:
> ...based on the instruction a = a + 1. So I quickly implemented
> the same on the OOPic, which resulted in about 140 BIPS - over
> 500 times less than the BasicX.

There was some discussion here, months ago, about how NetMedia
arrived at that figure. After thinking about it for a while I
constructed an experiment that produced a number very close to
theirs. First, I ran the following program:

Sub Main()
Register.DDRC = 1
Do
Register.PortC = Register.PortC Xor 1
Loop
End Sub

This code generates a square wave on pin 12 whose period is twice
the loop execution time. This establishes a baseline for the next
test:

Sub Main()
Dim i as Integer
Register.DDRC = 1
Do
i = i + 1
Register.PortC = Register.PortC Xor 1
Loop
End Sub

The difference between the period of the square wave generated by
this test and that generated by the previous test is two times the
execution time of the instruction i = i + 1. The observed result
confirms NetMedia's claim.

Note that this instruction is somewhat of a special case. The BasicX
pcode instruction set only has a direct increment opcode for 16-bit
values (local or module-level variables). This means that the code
for i = i + 1 results in a single pcode instruction. If you change
the test code to use a Byte or Long the execution time increases
greatly because the generated pcode for the increment operation is 3
instructions: push value, increment, pop value.

Don