The BASIC programming language, which stands for “Beginner’s All-purpose Symbolic Instruction Code,” was created over 50 years ago, evolving into several variants and platforms for general-purpose and high-level programming languages. Designed by John G. Kemeny and Thomas E. Kurtz at Dartmouth College in 1964, the sole purpose of BASIC was to encourage students of various fields to use computers. Throughout the years, versions of BASIC became more common and were featured in microcomputers in the mid-1970s and 1980s. The firmware of microcomputers typically contained BASIC and was shipped with the programming language. Eventually, professionals, small business owners, consultants, and hobbyists caught on to BASIC, using it to develop software on personal computers for accessibility and affordability purposes. To this day, the programming language remains relevant among different dialects and languages for developers.

Laird’s smartBASIC is a modern, event driven version of the BASIC programming language optimized for use on low-cost embedded systems with restricted memory. Developed in 2005, smartBASIC was created on the fundamentals of being extensible, easy-to-use, and making development quicker for embedded systems. It features a file system for storing BASIC applications and user non-volatile data. smartBASIC allows for easy adjustments and customization, which means end users are in complete control of the final mile of the devices functionality and not reliant on Laird developer resources to provide those features.

smartBASIC Classic bluetooth/ BLE pairing

Unlike many BASIC implementations, Laird’s smartBASIC is not line based. It cuts out hundreds of C code lines for end programmers, which quickens time to market. Similar to Visual BASIC, which is featured in Microsoft Office products, smartBASIC incorporates proper functions and subroutines. Developed for an embedded environment, smartBASIC’s paradigm is event driven, causing functions and subroutines to be triggered by external and internal activities. Built in functions and subroutines are featured in smartBASIC, which exposes an easy to use API to various hardware peripherals embedded in the device. These built in functions and subroutines are written in ‘C’ by Laird and bind to appropriately named functons for smartBASIC app developers. User functions and subroutines are also written by smartBASIC developers to help with writing code that is simpler and easier to maintain. It is the user functions that bind to event handlers.

When a GPIO state changes, a UART character arrives, or any asynchronous activity happens, an event is thrown by the firmware (which is written in ‘C’ by Laird), then handlers that are written and registered by the app developer get automatically called. Laird’s smartBASIC user manuals provides a full list of events.

Classic programming uses a model of sequential processes, which can be overwhelming for programmers. To simplify the process, smartBASIC allows users to react to events in the midst of the programming process. Therefore, a developing programmer can easily grasp the process and not need to know a complete model of a typical program before coding.

A typical smartBASIC application developer will start with awareness of all the events that can be generated by a device. Then the developer will write an initialization code that will result in one or more events being thrown by the firmware and reacting to those events via user handler functions, allowing appropriate functions to generate more events in the future. The application source code will typically have a last line, which is the statement WAITEVENT. The firmware is optimized, so that when it gets to the WAITEVENT statement at run time it will try to get into the lowest power state. Power optimization for battery powered devices is built in by default. A sample of a smartBASIC application demonstrating this paradigm is illustrated below.

To learn more about how Laird’s smartBASIC can leverage your time to market, visit our smartBASIC for BLE homepage.

embedded processorsmartBASIC Example

Leave a Reply

Your email address will not be published. Required fields are marked *

Real Time Analytics