World Library  
Flag as Inappropriate
Email this Article

Tibbo BASIC

Article Id: WHEBN0032186525
Reproduction Date:

Title: Tibbo BASIC  
Author: World Heritage Encyclopedia
Language: English
Subject: Basic4android, GW-BASIC, XBLite, FutureBASIC, NS Basic
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Tibbo BASIC

Tibbo BASIC
Developer(s) Tibbo Technology, Inc.
Stable release 2.5 / June 2011
Operating system Windows development;
TiOS (Tibbo Operating System) for running on embedded devices.
Type BASIC
License Copyright © 2000-2011 Tibbo Technology, Inc., Proprietary

Tibbo BASIC is a dialect of the BASIC programming language, designed for programmable logic controllers, Ethernet modules and other programmable hardware devices, both external and internal (embeddable). It is developed and distributed by Tibbo Technology Inc., a leading manufacturer of programmable Ethernet converters and controllers in Taipei, Taiwan.[1][2]

Language features

The programming language features of Tibbo BASIC are motivated by its use in building software applications for small external devices that need to perform fast, have access only to a small memory space and are robust under failure. These requirements determine both the power of the language and its limitations for adopting it for widely different purposes.[3]

For optimized performance on embedded devices, the language was designed as an explicitly, strongly and statically typed, asynchronous, event-driven programming language with object extensions and implicit error handling. Continuation-style event-handling is supported by special doevents statements to handle high-priority events.[4] To speed up run-time performance, the source code is transformed by a specially developed BASIC compiler[note 1] into intermediate-level code ("pseudo-code") and later interpreted and executed by a virtual machine for added resilience under failure.

Allowed variable types include byte, word, dword, char, short, long, real, boolean and user-defined structures and enumeration types.[4] Both integer arithmetic and floating point arithmetic are supported.[5]

Input-output functions, specific to a particular hardware device, are separated out from the rest of the language (called the core), making the remaining language in some sense more pure.[4]

The hardware devices are conceptualized in terms of platforms.[5] Each platform is characterized by a particular set of predefined objects, properties, methods and events that describe its capabilities, e.g. storing data in memory or opening up a TCP connection and sending a message.[note 2] Objects are independent of each other and not defined in terms of classes or class hierarchies but their significance lies in treating complex low-level hardware constructs and operations as simple high-level primitives and thus greatly simplifying programming and reprogramming the device.[3] As an example, the following code establishes a TCP connection with a target device (here assumed to have a default IP address) and sends the specified message:

sub on_button_pressed
       sock.connect
       sock.setdata("This is a string waiting to be sent.")
       sock.send
end sub

Tibbo BASIC core language can contain user-defined structures but no objects or methods.[4]

Debugging of programs is done in the development environment, without a need for external in-circuit emulators, as is common with programs written in hardware description languages for embedded devices.

System components

A screenshot of Tibbo Integrated Development Environment

Tibbo BASIC is part of a rapid programming framework, called TAIKO, that includes also an Integrated Development Environment and a specialized Operating System.[3]

The Integrated Development Environment, called TIDE, contains a source code editor, a compiler and a debugger.[6]

The graphical source code editor is used to facilitate the writing of the programs;[7] Tibbo BASIC source code is saved in files with .tbs file suffix.

The compiler is used for translating the source-code from the high-lever user-friendly format into a lower-level pseudo-code (.tpc suffix for Tibbo pseudo-code).

The debugger is used for checking that the program performs without errors. To verify this, the target hardware device is connected to the personal computer on which the program was developed, and the program is executed with different variable assignments and by triggering different combinations of possible events. While the program is running on the embedded device, its control flow and parameter settings can be observed in TIDE.

The programs on the embedded device run in a special operating system, called TiOS (Tibbo Operating System).[3] TiOS runs two processes, the Master Process and the VM (virtual machine).[5]

The Master Process controls communications with VM, TIDE and the events generated on the device. The VM interprets the compiled form of the program from the pseudo-code further into native binary code that the hardware processor can understand, and executes the program.

Because the VM is under the control of the Master Process, the Master Process can restart the VM (and so also the Tibbo BASIC program) if there are errors in the program that make the VM crash, and send information to TIDE about the execution state of the program during the crash for debugging and correcting.

Example code

The following example shows Tibbo BASIC code that on an embedded device that is equipped with a button and green and red LED lights, after a user presses the button, outputs "Hello World!" in Morse code by the blinking of the lights. The line symbol of the Morse code is represented by a long pulse of the green light ('GGG') and the dot symbol by a short pulse of the red light ('R'). Line ('-') means that both lights are off.

'===============================================================================
'            HELLO WORLD IN MORSE CODE
'===============================================================================
dim hello_world as string 
dim length, play_position as integer
const PAT_PLAY_CHUNK_LENGTH = 15
declare sub play_next
'--------------------------------------------------------------------

----
sub on_sys_init
       hello_world =                
               "R-R-R-R---R---R-GGG-R-R---R-GGG-R-R---GGG-GGG-GGG" +
               "-------" +
               "R-GGG-GGG---GGG-GGG-GGG---R-GGG-R---R-GGG-R-R---GGG-R-R" +
               "-------" +                
               "R-R-GGG-GGG-R-R-"
       length = len(hello_world)
       play_position = 0
end sub
'-------------------------------------------------------------------------------
sub on_button_pressed
       play_position = 1
       play_next
end sub
'-------------------------------------------------------------------------------
sub on_pat        
       play_next
end sub
'-------------------------------------------------------------------------------
sub play_next
       if length < play_position then exit sub
       dim chunk_len as integer        
       chunk_len = length - play_position + 1
       if chunk_len > PAT_PLAY_CHUNK_LENGTH then chunk_len = PAT_PLAY_CHUNK_LENGTH

       dim chunk as string
       chunk = mid(hello_world, play_position, chunk_len)
       pat.play(chunk, YES)
       play_position = play_position + chunk_len
end sub

See also

Notes

  1. ^ This is unlike classical BASIC, which is interpreted and not compiled.
  2. ^ See language reference manual for details.

References

  1. ^ Chen, Ulysses (2010). "Embedded China 2010". Shanghai, China. Retrieved November 21, 2011. 
  2. ^ Sharshakov (March 31, 2009). "Tibbo AggreGate - The Complete Device Management Solution". Outsourced E-Commerce Solutions. Retrieved November 22, 2011. 
  3. ^ a b c d Cantrell, Tom (July 2006). "Device Surfer". Circuit Cellar: The magazine for computer applications 192: 78–85. 
  4. ^ a b c d "Language reference manual". Tibbo Technology. Retrieved June 10, 2011. 
  5. ^ a b c "Programming tutorial". Tibbo Technology. March 31, 2009. Retrieved June 10, 2011. 
  6. ^ "Integrated Development Environment". Tibbo Technology. Retrieved June 10, 2011. 
  7. ^ Freeman, John (September 20, 2007). "BASIC is back: Tibbo Technology gets serial ports networking". Fudzilla. Retrieved November 22, 2011. 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.