Potential New ZBasic User
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
Potential New ZBasic User
Hello,
I started with Parallax a few years ago, then I moved up to Picaxe, and now I'm ready to move on. I'm looking for 32bit floating point math capability in a Basic language environment. The PIC chips are unfortunately limited with floating point math, and I just don't trust BasicX, they fail to answer simple questions.
I'm very impressed with the ZBasic website and documentation and ready to purchase the ZX-40n. I'm new to AVR chips so I have a few questions... is the floating point math a software (as in PIC) or hardware feature? I there a simple document showing how to program a simple "hello" program, compile, and download to the chip? Appreciate your help. Thanks.
Liam
I started with Parallax a few years ago, then I moved up to Picaxe, and now I'm ready to move on. I'm looking for 32bit floating point math capability in a Basic language environment. The PIC chips are unfortunately limited with floating point math, and I just don't trust BasicX, they fail to answer simple questions.
I'm very impressed with the ZBasic website and documentation and ready to purchase the ZX-40n. I'm new to AVR chips so I have a few questions... is the floating point math a software (as in PIC) or hardware feature? I there a simple document showing how to program a simple "hello" program, compile, and download to the chip? Appreciate your help. Thanks.
Liam
Potential New ZBasic User
> ... BasicX, they fail to answer simple questions...
Please. You never spoke with anyone associated with BasicX beyond being
longtime users; we are volunteers, friend, there, and here, to help
folks like you. Your difficulty is that you choose to ask us rather
than read the documentation to answer your "simple" questions - even
after I answered the first one, and steered you with a link to the
other answers. Read, man.
Tom
Please. You never spoke with anyone associated with BasicX beyond being
longtime users; we are volunteers, friend, there, and here, to help
folks like you. Your difficulty is that you choose to ask us rather
than read the documentation to answer your "simple" questions - even
after I answered the first one, and steered you with a link to the
other answers. Read, man.
Tom
Tom
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
"BasicX" is the company, it's employees, their website and their forum. BasicX's sanctioned forum on yahoo was unable to answer simple questions, except for smug responses questioning my literacy. To me, a vendor's documentation and forum is a criteria for my purchase. I have read through a myriad of ZBasic's documenation in my spare time. MCUs are fascinating and I enjoy creating simple projects. But I am still new to microcontrollers, I don't have an electrical background, so I don't wholly understand it all. I have to rely on forums to get unstuck. I'm sorry if my questions bother you Tom, just ignore them. I can't stop asking questions because it bothers people. Forums are part of the learning process too, and I will use it as such. Thanks.
Liam
Liam
In general, I believe that ZBasic is a superset of BasicX, though I never used BasicX.
In this document
http://www.zbasic.net/doc/ZBasicRef.html
section 2.2, page 5, you'll see that floating point data types are supported.
and in
http://www.zbasic.net/doc/ZBasicSysLib.html
page 66 on csng() discusses float to long
I don't think ZBasic supports the double type, 64 bits. It's kind of burdensome for an 8 bit micro.
There is a floating point co-processor chip (3rd party) you may use if you are calculating the meaning of life or the angle between the earth and our nearest star 100 times a second.
s/non-employee of Elba Corp.
In this document
http://www.zbasic.net/doc/ZBasicRef.html
section 2.2, page 5, you'll see that floating point data types are supported.
and in
http://www.zbasic.net/doc/ZBasicSysLib.html
page 66 on csng() discusses float to long
I don't think ZBasic supports the double type, 64 bits. It's kind of burdensome for an 8 bit micro.
There is a floating point co-processor chip (3rd party) you may use if you are calculating the meaning of life or the angle between the earth and our nearest star 100 times a second.
s/non-employee of Elba Corp.
Re: Potential New ZBasic User
The floating point math is implemented in software. There are few, if any, microcontrollers that have a hardware floating point unit.liam.zbasic wrote:s the floating point math a software (as in PIC) or hardware feature?
At present, there is no step-by-step tutorial. That said, getting started is pretty simple. Here is an elementary "Hello, world" program in ZBasic:liam.zbasic wrote:Is there a simple document showing how to program a simple "hello" program, compile, and download to the chip?
Code: Select all
Sub Main()
Debug.Print "Hello, world!"
End Sub
- Launch the ZBasic IDE.
- Select "New..." from the Project menu
- In the edit box of the New Project dialog, type the name of the project, for example, hello.pjt. You may want to change the directory where the project file will be located by using the Browse... button on that dialog. Leave the checkboxes checked and click the OK button when ready to proceed.
- Note that the main source code file, hello.bas for example, is automatically created and an empty Main() subroutine is prepared in that file. Add a new second line containing the Debug.Print command from the example above.
- From the Options menu, select "Device Options..." and in the resulting dialog, select the device name corresponding to the ZX device that you have, e.g. ZX-24a. Click the OK button when ready to proceed.
- If the ZX is connected to a COM port on the PC other than COM1, you'll need to select the right COM port. Do this by selecting "Serial Port Options..." from the Options menu and then choosing the right COM port from the dropdown box labeled "Serial Port". Press OK when ready to continue.
- Compile your program by pressing the F7 key or by selecting Compile from the Project menu. In the Output window at the bottom of the IDE, you should see that the compile completed with no errors. If an error message appears, recheck the program to verify that it matches the sample above and compile it again.
- Download the compiled program the the ZX by pressing the F5 key or by selecting Go from the Project menu. If the download completes successfully, you should see the "Hello, world!" in the Debug window at the bottom of the IDE.
- Don Kinzer
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
dkinzer,
Thanks very much for your response. I learned to breadboard with the parallax stamp and picaxe. I've been examining the ZX-40 for purchase, but not sure whether to do the 40a or 40n. I'm steering away from 40a because the "advanced floating point" functions are "system level". I interpreted that to mean software floating point as opposed to hardware, but now I realize that's incorrect based on your info. I've been leaning toward the 40n due to its superior speed and non "system level" floating point, but I admit I don't wholly understand the meaning of "runs native code for the processor". The 40a and 40n are identically priced, the latter is faster, so would the 40n be appropriate for a post-parallax, post-picaxe user? I appreciate your comments.
Thanks very much for your response. I learned to breadboard with the parallax stamp and picaxe. I've been examining the ZX-40 for purchase, but not sure whether to do the 40a or 40n. I'm steering away from 40a because the "advanced floating point" functions are "system level". I interpreted that to mean software floating point as opposed to hardware, but now I realize that's incorrect based on your info. I've been leaning toward the 40n due to its superior speed and non "system level" floating point, but I admit I don't wholly understand the meaning of "runs native code for the processor". The 40a and 40n are identically priced, the latter is faster, so would the 40n be appropriate for a post-parallax, post-picaxe user? I appreciate your comments.
The notation "system level", which is applied to advanced floating point functions like sin, cos, tan, etc., is intended to indicate that those functions are implemented in system code. This is in direct contrast to BasicX where the advanced math functions are implemented in user code which implies both that they take up user code space and that they run more slowly. All floating point operations in all ZX devices, whether VM or native mode, are implemented identically.liam.zbasic wrote:I'm steering away from 40a because the "advanced floating point" functions are "system level".
Many (perhaps most) Basic-programmable microcontrollers implement the "virtual machine" model. For this model, the compiler translates your program to a series of special instructions, often called "pcode". When the program is downloaded, a special program on the microcontroller, called an interpreter or virtual machine, reads each instruction code and performs the corresponding action. Although this method results in slower execution, it has several advantages including generally smaller code size and a more controlled execution environment. The BasicStamp, BasicX, PIC-Axe and most ZX devices use the VM model.liam.zbasic wrote:I don't wholly understand the meaning of "runs native code for the processor".
With native mode devices, the compiler translates your program into instructions that are directly executed by the microcontroller. Because the "middle man" interpreter has been eliminated, the program runs substantially faster. The disadvantages of native mode devices are that a given program generally compiles to a larger downloadable size and there are potentially more details for you, the programmer, to handle that are typically taken care of by the virtual machine. That's why we recommend the native mode devices for advanced programmers.
If cost is a significant element of your decision-making process, don't forget that you need to buy additional components for the 40-pin ZX devices before they'll do anything useful.
- Don Kinzer
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
Do take Don Kinzer's advice and use the regular ZX-24 before going to the ZX-24n. The native mode weill ruin faster, but there is more complexity getting to the point of running the program.
On the regular ZX-24, using the virtual machine, it is a piece of cake going from writing, to downloading, to running. The development cycle is fast and easy.
If you need more I/O pins then there are other options available (in the greater ZX family) without having to hook up all the supporting hardware (a la ZX-40) yourself. While I have some of the larger devices, 99% of what I am doing can be done with the 24 pin device.
-Tony
P.S. You will never find better support than what you get here from Don (who designed, built the ZX and wrote the entire interpreter and compiler), and the other experts. I have been such a beneficiary of their expertise many times.
-T
On the regular ZX-24, using the virtual machine, it is a piece of cake going from writing, to downloading, to running. The development cycle is fast and easy.
If you need more I/O pins then there are other options available (in the greater ZX family) without having to hook up all the supporting hardware (a la ZX-40) yourself. While I have some of the larger devices, 99% of what I am doing can be done with the 24 pin device.
-Tony
P.S. You will never find better support than what you get here from Don (who designed, built the ZX and wrote the entire interpreter and compiler), and the other experts. I have been such a beneficiary of their expertise many times.
-T
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
My package of chips and "parts kit" arrived. Very excited. The ZX-40a schematic (suggested serial interface #1) calls out several 6.8K resistors - same with the ZX-40a chip. However, the "ZX parts kit" only has 10K resistors. Is this okay? Also, the packaging elaborately protects all parts from ESD. Is this really a concern now that the parts safely arrived? Thanks.
The value is not critical. Although the ZX-24 and ZX-24a originally used 6.8K resistors, the current production uses 10K. The higher value reduces power consumption slightly.liam.zbasic wrote:However, the "ZX parts kit" only has 10K resistors.
ESD damage is always a potential problem. The likelihood of damage depends on the environmental conditions. Generally speaking, you should be OK if you always touch something that is grounded (e.g. a metal computer case) first before touching any parts.liam.zbasic wrote:Is [ESD] really a concern now that the parts safely arrived?
You can find more information on ESD damage prevention online.
- Don Kinzer
-
- Posts: 163
- Joined: 24 March 2008, 23:33 PM
- Location: Southern California (Blue)
My ZX-40a is working (after fixing a few misplaced wires). Your quickstart instructions were very helpful.
I noticed that the "suggested serial interface #1" and the transistor's collector is probably missing a 10K resistor to +5V. Is this correct or is the 10K resistor just an extra? My ZX-40a is working fine with this setup.
I've fiddled with the "hello world" program, added subroutines, add floating point equations, and absolutely impressed that Elba corp. was able to implement visual basic with floating point capability. I can not see ever using my one basic stamp and pbasic ever again (and too expensive). Although I'll always have a special place for picaxe chips (great forum).
Thank you for your great product.
I noticed that the "suggested serial interface #1" and the transistor's collector is probably missing a 10K resistor to +5V. Is this correct or is the 10K resistor just an extra? My ZX-40a is working fine with this setup.
I've fiddled with the "hello world" program, added subroutines, add floating point equations, and absolutely impressed that Elba corp. was able to implement visual basic with floating point capability. I can not see ever using my one basic stamp and pbasic ever again (and too expensive). Although I'll always have a special place for picaxe chips (great forum).
Thank you for your great product.
The circuit diagram in the manual has two resistors in the upper left corner. The leftmost of those is connected to the collector of the transistor and the RST/ input of the processor.liam.zbasic wrote:I noticed that the "suggested serial interface #1" and the transistor's collector is probably missing a 10K resistor to +5V.
- Don Kinzer