Discussion forum for the BasicX family of microcontroller chips.
Potential BasicX User & Floating Point Math - "liam.basicx" - Mar 15 16:44:00 2008
Hello,
I stumbled across microcontrollers at Fry's a couple of years back. I
purchased a Parallax kit and found it intriguing and fun. Then I
discovered picaxe and became addicted with the enhanced basic
commands, the built-in analog-to-digital converter, the background PWM
control, the simplicity, and the price! All excellent for learning.
The problem I have with both chips is the inability to do floating
point math. External chips exist to help, but it slows the
programming effort with cryptic equations and slows down the
microcontroller.
Then I discovered BasicX in the hopes a finding a chip with floating
point math capability. My question to you is this... is floating
point possible as in Visual Basic, Fortran, Matlab, etc? For
instance, would the following lines of code function in basicX:
x = -2.1;
y = exp(x);
x = 1/(-3.14) * x^( sin(2*3.14*y) );
Appreciate your comments. Thanks.
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Potential BasicX User & Floating Point Math - Tom Becker - Mar 15 18:36:52 2008
> ...is floating point possible as in Visual Basic...
Yes, of course. Welcome to the group. It's time to read the first
page or two of the documentation:
http://www.basicx.com/downloads/bx-setup-210-docs.zip
Single-precision floats (32-bit, about 7 decimal digits) and the
common functions are a standard feature of BasicX.
Your test throws a curve. The third line is invalid in both VB6 and
BasicX; neither permit exponentiation of a negative value to a
fractional power. If you make x positive, both will report similar
values.
Option Explicit
Public Sub Main()
dim x as single, y as single, z as single
x = 2.1
y = exp(x)
x = 1.0/(-3.14) * x^(sin(2.0*3.14*y))
debug.print cstr(x) &" "& cstr(y)
End Sub
*** Opening file: C:\Documents and
Settings\Owner\Desktop\GPS_Becker\Project1.bxb
*** Downloading File
Writing internal EEPROM
Verifying internal EEPROM
Verify OK
Writing external EEPROM
Verifying external EEPROM
Verify OK
*** Finished Downloading
-00000000 0.1224565
Option Explicit
Public Sub Main()
dim x as single, y as single, z as single
x = 2.1
y = exp(x)
x = 1.0/(-3.14) * x^(sin(2.0*3.14*y))
debug.print cstr(x) &" "& cstr(y)
End Sub
*** Opening file: C:\Documents and
Settings\Owner\Desktop\GPS_Becker\Project1.bxb
*** Downloading File
Writing internal EEPROM
Verifying internal EEPROM
Verify OK
Writing external EEPROM
Verifying external EEPROM
Verify OK
*** Finished Downloading
-0.5988321 8.166168
Tom
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
RE: Potential BasicX User & Floating Point Math - "Harry J. White" - Mar 18 20:38:05 2008
I believe the answer to your question is yes. You should take another look
at Parallax. They have a new chip with eight processors that is very
exciting.
_____
From: b...@yahoogroups.com [mailto:b...@yahoogroups.com] On Behalf Of
liam.basicx
Sent: Saturday, March 15, 2008 2:27 PM
To: b...@yahoogroups.com
Subject: [BasicX] Potential BasicX User & Floating Point Math
Hello,
I stumbled across microcontrollers at Fry's a couple of years back. I
purchased a Parallax kit and found it intriguing and fun. Then I
discovered picaxe and became addicted with the enhanced basic
commands, the built-in analog-to-digital converter, the background PWM
control, the simplicity, and the price! All excellent for learning.
The problem I have with both chips is the inability to do floating
point math. External chips exist to help, but it slows the
programming effort with cryptic equations and slows down the
microcontroller.
Then I discovered BasicX in the hopes a finding a chip with floating
point math capability. My question to you is this... is floating
point possible as in Visual Basic, Fortran, Matlab, etc? For
instance, would the following lines of code function in basicX:
x = -2.1;
y = exp(x);
x = 1/(-3.14) * x^( sin(2*3.14*y) );
Appreciate your comments. Thanks.
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )