PBASIC Programming/History

From Wikibooks, open books for an open world
Jump to navigation Jump to search


[edit | edit source]

A modern desktop computer contains a special type of chip called a "Microprocessor". Microprocessors are common, and you hear about them all the time: "Pentium", "Athlon", "Core 2 Duo", etc. A microprocessor can do certain math calculations and it can execute instructions, but it relies on the rest of your computer (mother board, RAM, etc.) to operate. Take away one of the other parts of the system, and your computer will not work.

Similar to a microprocessor is the microcontroller, a smaller type of device that is more self-reliant. Microcontrollers do not need a special motherboard, or a special power supply, or even additional RAM to operate: you can plug them in and they will work perfectly. Microcontrollers are also typically very small and cheap as well, making them a good addition to almost any design project.

Microcontrollers can be found in all sorts of devices, anywhere from a cellular phone to a digital microwave to your car and your television. If you have something that has buttons, or something more complicated then a paper weight, it probably has a microcontroller inside.

MicroChip PIC

[edit | edit source]

A common and popular type of microcontroller is the PIC, made by a company called Microchip. PIC is not just one microcontroller, but a whole family of them, each with a different size, different shape, different abilities, and a different price. Because of the large range of options, the small size, and the low price, PIC microncontrollers have been very popular devices among hobbyists and engineers. However, PICs have a number of different problems that make their use more difficult:

  1. They are difficult to program. Some PICs can only be programmed once, which means that you can't make any mistakes (and everybody makes mistakes). For PICs that can be reprogrammed, you need to either build a programmer or you need to buy one. Programmers are relatively complex circuits and can be tough to build. However, the programmers that you can buy might be very expensive.
  2. They are programmed using an assembly language. Assembly language is very low-level, meaning that it is easier for a computer to understand, and harder for a human to understand. Also, programming in assembly requires you know know what is inside the microcontroller, the "architecture", which can be very difficult indeed.
  3. They don't have power regulation. A PIC requires a separate power regulator circuit, to help prevent too much power from going into the chip and destroying it. Power regulators typically need to be built by hand, which can be tricky.


[edit | edit source]

The Parallax company decided to use the PIC processor, but to make it easier for people to use. They took a very small version of the PIC, added memory for bigger programs, added a voltage regulator, added an oscillator, and they preprogrammed it with a BASIC interpreter. The result was the BasicStamp. BASIC is a family of computer programming languages which were designed to be very simple and easy to learn. It is much easier and faster to write a program in BASIC then it is to write the same program in PIC assembly. The designer now doesn't need to build any of the circuits that needed to be built with the PIC: no voltage regulator, no oscillator circuit, and no programmer. This helps to speed up development time. Projects using the BasicStamps can be smaller and simpler then projects using just PICs.

The version of BASIC used in the BasicStamp is called PBASIC. This book will discuss the PBASIC language as it applies to the BasicStamp.


[edit | edit source]