Tibbo GA1000 User Manual

*** USER’S MANUAL ***
FCC ID : XOJGA1000
The Federal Communication Commission Statement
This equipment h as been tested a nd found to compl y with the limits fo r a Class B Digit al Device, pursuant to Part 15 of the FCC rules. These limits are designed to provide reasonable protection against harmful interferenc e in a residential installation. Th is equipment gen erates, uses a nd can radiate r adio frequency energy and, if not i nstal led and us ed in acc ord ance with the instr uction, may c ause harm ful inter feren ce to radio communication. However, there is no guarantee that interference will not occur in a particular installation. If this equipm ent doe s cause h armful interfer ence to r adio or televi sion r eceptio n, whic h can be determined by turning the equipment off and on, the user is encouraged to try to correct the interference by one of more of the following measures: -
- Reorient or relocate the receiving antenna.
- Increase the separation between the equipm e nt and rec ei ver.
- Connect the eq uipment i nto an outle t on a c ircuit dif ferent from that to which the receiver is
connected.
- Consult the dealer or an experi enced Radio/TV technician for help.
Use only shielded cables to connect I/O devices to this equipment. You are cautioned that change or modifications no t expressl y approved by th e party respon sible for compli ance could void yo ur authority to operate the equipment.
THIS DEVICE COMPLIES WITH PART 15 OF FCC RULES. OPERATION IS SUBJECT TO THE FOLLOWING TWO CONDITIONS: -
1. This device may not cause harmful interferenc e and
2. This device must accept any interference received, including interference that may cause undesired operation.
The antenna used for this transmitter must not be collocated or operation in conjunction with any other antenna or transmitter.
TIDE and Tibbo BASIC User ManualI
Table of Contents
Taiko R2
................................................................................................................................... 1Legal Information
Overview 4
................................................................................................................................... 4Our Language Philosophy
................................................................................................................................... 7System Components
............................................................................................................................................................... 8Objects
............................................................................................................................................................... 8Events
Getting Started 9
................................................................................................................................... 9Preparing Your Hardware
................................................................................................................................... 10Starting a New Project
................................................................................................................................... 11Writing Code
................................................................................................................................... 14Building, Uploading and Running
................................................................................................................................... 15Compiling a Final Binary
Programming with TIDE 15
................................................................................................................................... 15Managing Projects
............................................................................................................................................................... 15The Structure of a Project
............................................................................................................................................................... 17Creating, Opening and Saving Projects
............................................................................................................................................................ 17Templates
............................................................................................................................................................... 18Adding, Removing and Saving Files
............................................................................................................................................................... 20Resource Files
............................................................................................................................................................... 20Built-in Image Editor
............................................................................................................................................................... 22Coding Your Project
............................................................................................................................................................ 22Project Browser
............................................................................................................................................................ 23Code Auto-completion
............................................................................................................................................................ 24Code Hinting
............................................................................................................................................................ 24Tooltips
.......................................................................................................................................................... 26Supported HTML Tags
............................................................................................................................................................... 26Making, Uploading and Running an Executable Binary
............................................................................................................................................................ 27Two Modes of Target Execution
............................................................................................................................................................... 28Debugging Your Project
............................................................................................................................................................ 28Target States
.......................................................................................................................................................... 29Exceptions
............................................................................................................................................................ 30Program Pointer
............................................................................................................................................................ 30Breakpoints
............................................................................................................................................................ 31The Call Stack and Stack Pointer
............................................................................................................................................................ 32Stepping
............................................................................................................................................................ 33The Watch
.......................................................................................................................................................... 37Scopes in Watch
............................................................................................................................................................ 37Code Profiling
............................................................................................................................................................... 38Project Settings
................................................................................................................................... 39Programming Fundamentals
............................................................................................................................................................... 39Program Structure
............................................................................................................................................................... 40Code Basics
............................................................................................................................................................... 42Naming Conventions
............................................................................................................................................................... 43Introduction to Variables, Constants and Scopes
............................................................................................................................................................ 43Variables And Their Types
1
©2000-2008 Tibbo Technology Inc.
............................................................................................................................................................ 45Type Conversion
............................................................................................................................................................ 48Type conversion in expressions
............................................................................................................................................................ 49Compile-time Calculations
............................................................................................................................................................ 50Arrays
............................................................................................................................................................ 54Structures
............................................................................................................................................................ 55Enumeration Types
............................................................................................................................................................ 57Understanding the Scope of Variables
............................................................................................................................................................ 60Declaring Variables
............................................................................................................................................................ 60Constants
............................................................................................................................................................... 62Introduction to Procedures
............................................................................................................................................................ 64Passing Arguments to Procedures
............................................................................................................................................................ 66Memory Allocation for Procedures
............................................................................................................................................................... 67Introduction to Control Structures
............................................................................................................................................................ 67Decision Structures
............................................................................................................................................................ 68Loop Structures
............................................................................................................................................................ 68Doevents
............................................................................................................................................................... 71Using Preprocessor
............................................................................................................................................................ 73Scope of Preprocessor Directives
............................................................................................................................................................... 74Working with HTML
............................................................................................................................................................ 76Embedding Code Within an HTML File
............................................................................................................................................................... 77Understanding Platforms
............................................................................................................................................................ 78Objects, Events and Platform Functions
IIContents
Language Reference 78
................................................................................................................................... 79Statements
............................................................................................................................................................... 79Const Statement
............................................................................................................................................................... 79Declare Statement
............................................................................................................................................................... 81Dim Statement
............................................................................................................................................................... 82Doevents Statement
............................................................................................................................................................... 82Do... Loop Statement
............................................................................................................................................................... 84Enum Statement
............................................................................................................................................................... 85Exit Statement
............................................................................................................................................................... 86For... Next Statement
............................................................................................................................................................... 87Function Statement
............................................................................................................................................................... 88Goto Statement
............................................................................................................................................................... 89If.... Then... Else Statement
............................................................................................................................................................... 90Include Statement
............................................................................................................................................................... 91Select-Case Statement
............................................................................................................................................................... 93Sub Statement
............................................................................................................................................................... 94Type Statement
............................................................................................................................................................... 95While-Wend Statement
................................................................................................................................... 96Keywords
............................................................................................................................................................... 96As
............................................................................................................................................................... 97Boolean
............................................................................................................................................................... 97ByRef
............................................................................................................................................................... 97Byte
............................................................................................................................................................... 97ByVal
............................................................................................................................................................... 97Char
............................................................................................................................................................... 97Else
............................................................................................................................................................... 97End
............................................................................................................................................................... 98False
............................................................................................................................................................... 98For
............................................................................................................................................................... 98Integer
............................................................................................................................................................... 98Next
............................................................................................................................................................... 98Public
............................................................................................................................................................... 98Short
............................................................................................................................................................... 98Step
©2000-2008 Tibbo Technology Inc.
TIDE and Tibbo BASIC User ManualIII
............................................................................................................................................................... 98String
............................................................................................................................................................... 98Then
............................................................................................................................................................... 99Type
............................................................................................................................................................... 99To
............................................................................................................................................................... 99True
............................................................................................................................................................... 99Word
................................................................................................................................... 99Operators
................................................................................................................................... 101Error Messages
............................................................................................................................................................... 101C1001
............................................................................................................................................................... 101C1002
............................................................................................................................................................... 102C1003
............................................................................................................................................................... 102C1004
............................................................................................................................................................... 102C1005
............................................................................................................................................................... 103C1006
............................................................................................................................................................... 103C1007
............................................................................................................................................................... 104C1008
............................................................................................................................................................... 104C1009
............................................................................................................................................................... 104C1010
............................................................................................................................................................... 105C1011
............................................................................................................................................................... 105C1012
............................................................................................................................................................... 106C1013
............................................................................................................................................................... 106C1014
............................................................................................................................................................... 106C1015
............................................................................................................................................................... 107C1016
............................................................................................................................................................... 107C1017
............................................................................................................................................................... 107C1018
............................................................................................................................................................... 108C1019
............................................................................................................................................................... 108C1020
............................................................................................................................................................... 108C1021
............................................................................................................................................................... 109C1022
............................................................................................................................................................... 109C1023
............................................................................................................................................................... 110C1024
............................................................................................................................................................... 110L1001
............................................................................................................................................................... 110L1002
............................................................................................................................................................... 111L1003
............................................................................................................................................................... 111L1004
............................................................................................................................................................... 111L1005
............................................................................................................................................................... 111L1006
............................................................................................................................................................... 112L1007
............................................................................................................................................................... 112L1008
............................................................................................................................................................... 112L1009
................................................................................................................................... 113Objects, Properties, Methods, Events
Development Environment
................................................................................................................................... 113Installation Requirements
................................................................................................................................... 113User Interface
............................................................................................................................................................... 114Main Window
............................................................................................................................................................... 114Operation Modes
............................................................................................................................................................... 115Menu Bar
............................................................................................................................................................ 115File Menu
............................................................................................................................................................ 116Edit Menu
............................................................................................................................................................ 117View Menu
............................................................................................................................................................ 117Project Menu
............................................................................................................................................................ 118Debug Menu
............................................................................................................................................................ 119Image Menu
............................................................................................................................................................ 119Window Menu
113
©2000-2008 Tibbo Technology Inc.
............................................................................................................................................................... 120Toolbars
............................................................................................................................................................... 126Status Bar
............................................................................................................................................................... 126Dialogs
............................................................................................................................................................... 128Panes
............................................................................................................................................................... 131Language Element Icons
IVContents
............................................................................................................................................................ 120Help Menu
............................................................................................................................................................ 120Project Toolbar
............................................................................................................................................................ 121Debug Toolbar
............................................................................................................................................................ 122Image Editor Toolbar
............................................................................................................................................................ 122Tool Properties Toolbar
.......................................................................................................................................................... 123Selection Tool Properties
.......................................................................................................................................................... 123Paint Tool Properties
.......................................................................................................................................................... 123Eraser Tool Properties
.......................................................................................................................................................... 123Text Tool Properties
.......................................................................................................................................................... 124Line Tool Properties
.......................................................................................................................................................... 124Rectangle Tool Properties
.......................................................................................................................................................... 125Ellipse Tool Properties
.......................................................................................................................................................... 126Zoom Tool Properties
............................................................................................................................................................ 127Project Settings
............................................................................................................................................................ 127New Project
............................................................................................................................................................ 128Add File to Project
............................................................................................................................................................ 128Graphic File Properties Dialog
............................................................................................................................................................ 128Call Stack
............................................................................................................................................................ 129Output
............................................................................................................................................................ 129Project
.......................................................................................................................................................... 129Browser
.......................................................................................................................................................... 130Files
............................................................................................................................................................ 130Watch
............................................................................................................................................................ 130Colors
Glossary of Terms 131
................................................................................................................................... 131Compilation Unit
................................................................................................................................... 131Compiler
................................................................................................................................... 132Construct
................................................................................................................................... 132Cross-Debugging
................................................................................................................................... 132Identifier
................................................................................................................................... 132Keyword
................................................................................................................................... 132Label
................................................................................................................................... 132Linker
................................................................................................................................... 132P-Code
................................................................................................................................... 132Syscall
................................................................................................................................... 133Target
................................................................................................................................... 133Virtual Machine
Platforms 133
................................................................................................................................... 133Platform Specifications
............................................................................................................................................................... 134EM202 Platform
............................................................................................................................................................ 134Memory Space
............................................................................................................................................................ 134Supported Variabled Types
............................................................................................................................................................ 134Supported Functions (Syscalls)
............................................................................................................................................................ 135Supported Objects
............................................................................................................................................................ 135Platform-dependent Constants
.......................................................................................................................................................... 136Enum pl_redir
©2000-2008 Tibbo Technology Inc.
TIDE and Tibbo BASIC User ManualV
.......................................................................................................................................................... 136Enum pl_io_num
............................................................................................................................................................ 136Platform-dependent Programming Information
............................................................................................................................................................... 139EM1000 and EM1000W Platforms
............................................................................................................................................................ 140Memory Space
............................................................................................................................................................ 140Supported Objects
............................................................................................................................................................ 140Platform-dependent Constants
.......................................................................................................................................................... 141Enum pl_redir
.......................................................................................................................................................... 142Enum pl_io_num
.......................................................................................................................................................... 144Enum pl_int_num
.......................................................................................................................................................... 145Enum pl_sock_interfaces
............................................................................................................................................................ 145Platform-dependent Programming Information
............................................................................................................................................................... 149EM1202 and EM1202W Platforms
............................................................................................................................................................ 149Memory Space
............................................................................................................................................................ 150Supported Objects
............................................................................................................................................................ 150Platform-dependent Constants
.......................................................................................................................................................... 150Enum pl_redir
.......................................................................................................................................................... 151Enum pl_io_num
.......................................................................................................................................................... 153Enum pl_int_num
.......................................................................................................................................................... 154Enum pl_sock_interfaces
............................................................................................................................................................ 154Platform-dependent Programming Information
............................................................................................................................................................... 158EM1206 and EM1206W Platforms
............................................................................................................................................................ 158Memory Space
............................................................................................................................................................ 159Supported Objects
............................................................................................................................................................ 159Platform-dependent Constants
.......................................................................................................................................................... 159Enum pl_redir
.......................................................................................................................................................... 160Enum pl_io_num
.......................................................................................................................................................... 162Enum pl_int_num
.......................................................................................................................................................... 162Enum pl_sock_interfaces
............................................................................................................................................................ 163Platform-dependent Programming Information
............................................................................................................................................................... 166DS1202 Platform
............................................................................................................................................................ 167Memory Space
............................................................................................................................................................ 167Supported Objects
............................................................................................................................................................ 167Platform-dependent Constants
.......................................................................................................................................................... 167Enum pl_redir
.......................................................................................................................................................... 169Enum pl_io_num
.......................................................................................................................................................... 170Enum pl_int_num
.......................................................................................................................................................... 170Enum pl_sock_interfaces
............................................................................................................................................................ 171Platform-dependent Programming Information
............................................................................................................................................................... 174DS1206 Platform
............................................................................................................................................................ 175Memory Space
............................................................................................................................................................ 175Supported Objects
............................................................................................................................................................ 175Platform-dependent Constants
.......................................................................................................................................................... 175Enum pl_redir
.......................................................................................................................................................... 177Enum pl_io_num
.......................................................................................................................................................... 178Enum pl_int_num
.......................................................................................................................................................... 179Enum pl_sock_interfaces
............................................................................................................................................................ 179Platform-dependent Programming Information
............................................................................................................................................................... 182Common Information
............................................................................................................................................................ 183Supported Variable Types (T1000-based Devices)
............................................................................................................................................................ 183Supported Functions (T1000-based Devices)
............................................................................................................................................................ 184LED Signals
............................................................................................................................................................ 185Debug Communications
............................................................................................................................................................ 186Project Settings Dialog
.......................................................................................................................................................... 187Device Explorer
................................................................................................................................... 189Function Reference
............................................................................................................................................................... 189Asc Function
............................................................................................................................................................... 190Bin Function
............................................................................................................................................................... 190Cfloat Function
©2000-2008 Tibbo Technology Inc.
............................................................................................................................................................... 191Chr Function
............................................................................................................................................................... 191Date Function
............................................................................................................................................................... 192Daycount Function
............................................................................................................................................................... 192Ddstr Function
............................................................................................................................................................... 193Ddval Function
............................................................................................................................................................... 194Ftostr Function
............................................................................................................................................................... 195Hex Function
............................................................................................................................................................... 195Hours Function
............................................................................................................................................................... 196.Insert Function
............................................................................................................................................................... 197Instr Function
............................................................................................................................................................... 197Lbin Function
............................................................................................................................................................... 198Left Function
............................................................................................................................................................... 198Len Function
............................................................................................................................................................... 199Lhex Function
............................................................................................................................................................... 199Lstr Function
............................................................................................................................................................... 200Lstri Function
............................................................................................................................................................... 200Lval Function
............................................................................................................................................................... 201Md5 Function
............................................................................................................................................................... 202Mid Function
............................................................................................................................................................... 203Mincount Function
............................................................................................................................................................... 203Minutes Function
............................................................................................................................................................... 204Month Function
............................................................................................................................................................... 205Random Function
............................................................................................................................................................... 205Right Function
............................................................................................................................................................... 205Sha1 Function
............................................................................................................................................................... 207Str Function
............................................................................................................................................................... 207Strgen Function
............................................................................................................................................................... 208Stri Function
............................................................................................................................................................... 209Strsum Function
............................................................................................................................................................... 209Strtof Function
............................................................................................................................................................... 210Val Function
............................................................................................................................................................... 210Vali Function
............................................................................................................................................................... 211Weekday Function
............................................................................................................................................................... 211Year Function
................................................................................................................................... 212Object Reference
............................................................................................................................................................... 212Sys Object
............................................................................................................................................................ 212Overview
.......................................................................................................................................................... 212On_sys_init Event
.......................................................................................................................................................... 213Buffer Management
.......................................................................................................................................................... 214System Timer
.......................................................................................................................................................... 215PLL Management
.......................................................................................................................................................... 216Serial Number
.......................................................................................................................................................... 217Miscellaneous
............................................................................................................................................................ 217Properties, Methods, Events
.......................................................................................................................................................... 217.Buffalloc Method
.......................................................................................................................................................... 218.Currentpll R/O Property (Selected Platforms Only)
.......................................................................................................................................................... 218.Freebuffpages R/O Property
.......................................................................................................................................................... 219.Halt Method
.......................................................................................................................................................... 219.Newpll Method (Selected Platforms Only)
.......................................................................................................................................................... 220On_sys_init Event
.......................................................................................................................................................... 220On_sys_timer Event
.......................................................................................................................................................... 220.Onsystimerperiod Property (Selected Platforms Only)
.......................................................................................................................................................... 221.Reboot Method
.......................................................................................................................................................... 221.Runmode R/O Property
.......................................................................................................................................................... 221Serialnum R/O Property
.......................................................................................................................................................... 222Setserialnum Method
.......................................................................................................................................................... 222.Resettype R/O Property
.......................................................................................................................................................... 223.Timercount R/O Property
VIContents
©2000-2008 Tibbo Technology Inc.
TIDE and Tibbo BASIC User ManualVII
.......................................................................................................................................................... 223.Totalbuffpages R/O Property
.......................................................................................................................................................... 223.Version R/O Property
............................................................................................................................................................... 224Ser Object
............................................................................................................................................................ 224What's new in V1.1
............................................................................................................................................................ 225Overview
.......................................................................................................................................................... 225Anatomy of a Serial Port
.......................................................................................................................................................... 225Three Modes of the Serial Port
....................................................................................................................................................... 226UART Mode
....................................................................................................................................................... 229Wiegand Mode
....................................................................................................................................................... 232Clock/Data Mode
.......................................................................................................................................................... 234Port Selection
.......................................................................................................................................................... 236Serial Settings
.......................................................................................................................................................... 239Sending and Receiving Data (TX and RX buffers)
....................................................................................................................................................... 239Allocating Memory for Buffers
....................................................................................................................................................... 240Using Buffers
....................................................................................................................................................... 240Buffer Memory Status
....................................................................................................................................................... 241Receiving Data
....................................................................................................................................................... 243Sending Data
....................................................................................................................................................... 244Handling Buffer Overruns
....................................................................................................................................................... 245Redirecting Buffers
....................................................................................................................................................... 245Sinking Data
............................................................................................................................................................ 246Properties, Methods, Events
.......................................................................................................................................................... 248.Autoclose Property
.......................................................................................................................................................... 248.Baudrate Property
.......................................................................................................................................................... 249.Bits Property
.......................................................................................................................................................... 249.Ctsmap property (Selected Platforms Only)
.......................................................................................................................................................... 250.Dircontrol Property
.......................................................................................................................................................... 250.Div9600 R/O Property
.......................................................................................................................................................... 251.Enabled Property
.......................................................................................................................................................... 251.Escchar Property
.......................................................................................................................................................... 251.Esctype Property
.......................................................................................................................................................... 253.Flowcontrol Property
.......................................................................................................................................................... 253.Getdata Method
.......................................................................................................................................................... 254.Interchardelay Property
.......................................................................................................................................................... 255.Interface Property
.......................................................................................................................................................... 255.Mode Property
.......................................................................................................................................................... 256.Newtxlen R/O Property
.......................................................................................................................................................... 257.Notifysent Method
.......................................................................................................................................................... 257.Num Property
.......................................................................................................................................................... 258.Numofports R/O Property
.......................................................................................................................................................... 258On_ser_data_arrival Event
.......................................................................................................................................................... 258On_ser_data_sent Event
.......................................................................................................................................................... 259On_ser_esc Event
.......................................................................................................................................................... 259On_ser_overrun Event
.......................................................................................................................................................... 260.Parity Property
.......................................................................................................................................................... 260.Redir Method
.......................................................................................................................................................... 261.Rtsmap Property (Selected Platforms Only)
.......................................................................................................................................................... 262.Rxbuffrq Method
.......................................................................................................................................................... 262.Rxbuffsize R/O Property
.......................................................................................................................................................... 263.Rxclear Method
.......................................................................................................................................................... 263.Rxlen R/O Property
.......................................................................................................................................................... 264.Send Method
.......................................................................................................................................................... 264.Setdata Method
.......................................................................................................................................................... 265.Sinkdata Property
.......................................................................................................................................................... 265.Txbuffrq Method
.......................................................................................................................................................... 266.Txbuffsize R/O Property
.......................................................................................................................................................... 266.Txclear Method
.......................................................................................................................................................... 266.Txfree R/O Property
.......................................................................................................................................................... 267.Txlen R/O Property
©2000-2008 Tibbo Technology Inc.
............................................................................................................................................................... 267Net Object
............................................................................................................................................................ 268Overview
.......................................................................................................................................................... 268Main Parameters
.......................................................................................................................................................... 269Checking Ethernet Status
............................................................................................................................................................ 269Properties, Methods, Events
.......................................................................................................................................................... 269.Mac R/O Property
.......................................................................................................................................................... 270.Ip Property
.......................................................................................................................................................... 270.Netmask Property
.......................................................................................................................................................... 270.Gatewayip Property
.......................................................................................................................................................... 271.Failure R/O Property
.......................................................................................................................................................... 271.Linkstate R/O Property
.......................................................................................................................................................... 271On_net_link_change Event
.......................................................................................................................................................... 272On_net_overrun Event
............................................................................................................................................................... 272Button Object
............................................................................................................................................................ 273On_button_pressed Event
............................................................................................................................................................ 273On_button_released Event
............................................................................................................................................................ 274.Pressed R/O Property
............................................................................................................................................................ 274.Time R/O Property
............................................................................................................................................................... 274Sock Object
............................................................................................................................................................ 275Overview
.......................................................................................................................................................... 276Anatomy of a Socket
.......................................................................................................................................................... 276Socket Selection
.......................................................................................................................................................... 277Handling Network Connections
....................................................................................................................................................... 278TCP connection basics
....................................................................................................................................................... 278UDP "connection" basics
....................................................................................................................................................... 279Accepting Incoming Connections
....................................................................................................................................................... 281Accepting UDP broadcasts
....................................................................................................................................................... 281Understanding TCP Reconnects
....................................................................................................................................................... 283Understanding UDP Reconnects and Port Switchover
....................................................................................................................................................... 286Incoming Connections on Multiple Sockets
....................................................................................................................................................... 287Establishing Outgoing Connections
....................................................................................................................................................... 288Sending UDP broadcasts
....................................................................................................................................................... 290Closing Connections
....................................................................................................................................................... 292Checking Connection Status
....................................................................................................................................................... 294More On the Socket's Asynchronous Nature
.......................................................................................................................................................... 297Sending and Receiving data
....................................................................................................................................................... 297Allocating Memory for Buffers
....................................................................................................................................................... 298Using Buffers in TCP Mode
....................................................................................................................................................... 299Using Buffers in UDP Mode
....................................................................................................................................................... 300TX and RX Buffer Memory Status
....................................................................................................................................................... 301Receiving Data in TCP Mode
....................................................................................................................................................... 303Receiving Data in UDP Mode
....................................................................................................................................................... 304Sending TCP and UDP Data
....................................................................................................................................................... 306"Split Packet" Mode of TCP Data Processing
....................................................................................................................................................... 307Handling Buffer Overruns
....................................................................................................................................................... 308Redirecting Buffers
....................................................................................................................................................... 309Sinking Data
.......................................................................................................................................................... 309Working With Inband Commands
....................................................................................................................................................... 309Inband Message Format
....................................................................................................................................................... 310Inband-related Buffers (CMD, RPL, and TX2)
....................................................................................................................................................... 311Processing Inband Commands
....................................................................................................................................................... 313Sending Inband Replies
.......................................................................................................................................................... 314Using HTTP
....................................................................................................................................................... 315HTTP-related Buffers
....................................................................................................................................................... 317Setting the Socket for HTTP
....................................................................................................................................................... 318Socket Behavior in the HTTP Mode
....................................................................................................................................................... 319Including BASIC Code in HTTP Files
....................................................................................................................................................... 320Generating Dynamic HTML Pages
....................................................................................................................................................... 322URL Substitution
VIIIContents
©2000-2008 Tibbo Technology Inc.
TIDE and Tibbo BASIC User ManualIX
....................................................................................................................................................... 323Working with HTTP Variables
....................................................................................................................................................... 323Simple Case (Small Amout of Variable Data)
....................................................................................................................................................... 324Complex Case (Large Amount of Variable Data)
....................................................................................................................................................... 326Details on Variable Data
............................................................................................................................................................ 327Properties, Methods, and Events
.......................................................................................................................................................... 327.Acceptbcast Property
.......................................................................................................................................................... 327.Allowedinterfaces Property
.......................................................................................................................................................... 328.Bcast R/O Property
.......................................................................................................................................................... 328.Close Method
.......................................................................................................................................................... 329.Cmdbuffrq Method
.......................................................................................................................................................... 329.Cmdlen R/O Property
.......................................................................................................................................................... 330.Connect Method
.......................................................................................................................................................... 330.Connectiontout Property
.......................................................................................................................................................... 331.Currentinterface R/O Property
.......................................................................................................................................................... 331.Discard Method
.......................................................................................................................................................... 331.Endchar Property
.......................................................................................................................................................... 332.Escchar Property
.......................................................................................................................................................... 332.Event R/O Property (Obsolete)
.......................................................................................................................................................... 332.Eventsimple R/O Property (Obsolete)
.......................................................................................................................................................... 333.Getdata Method
.......................................................................................................................................................... 333.Gethttprqstring Method
.......................................................................................................................................................... 334.Getinband Method
.......................................................................................................................................................... 334.Httpmode Property
.......................................................................................................................................................... 335.Httpnoclose Property
.......................................................................................................................................................... 335.Httpportlist Property
.......................................................................................................................................................... 336.Httprqstring R/O Property
.......................................................................................................................................................... 337.Inbandcommands Property
.......................................................................................................................................................... 337.Inconenabledmaster Property
.......................................................................................................................................................... 338.Inconmode Property
.......................................................................................................................................................... 338.Localport R/O Property
.......................................................................................................................................................... 339.Localportlist Property
.......................................................................................................................................................... 339.Newtxlen R/O Property
.......................................................................................................................................................... 339.Nextpacket Method
.......................................................................................................................................................... 340.Notifysent Method
.......................................................................................................................................................... 340.Num Property
.......................................................................................................................................................... 341.Numofsock R/O Property
.......................................................................................................................................................... 341.Outport Property
.......................................................................................................................................................... 342On_sock_data_arrival Event
.......................................................................................................................................................... 342On_sock_data_sent Event
.......................................................................................................................................................... 343On_sock_event Event
.......................................................................................................................................................... 343On_sock_inband Event
.......................................................................................................................................................... 343On_sock_overrun Event
.......................................................................................................................................................... 344On_sock_postdata
.......................................................................................................................................................... 344On_sock_tcp_packet_arrival Event
.......................................................................................................................................................... 345.Protocol Property
.......................................................................................................................................................... 345.Reconmode Property
.......................................................................................................................................................... 346.Redir Method
.......................................................................................................................................................... 347.Remoteip R/O Property
.......................................................................................................................................................... 348.Remotemac R/O Property
.......................................................................................................................................................... 348.Remoteport R/O Property
.......................................................................................................................................................... 348.Reset Method
.......................................................................................................................................................... 349.Rplbuffrq Method
.......................................................................................................................................................... 350.Rplfree R/O Property
.......................................................................................................................................................... 350.Rpllen R/O Property
.......................................................................................................................................................... 350.Rxbuffrq Method
.......................................................................................................................................................... 351.Rxbuffsize R/O Property
.......................................................................................................................................................... 351.Rxclear Method
.......................................................................................................................................................... 352.Rxpacketlen R/O Property
.......................................................................................................................................................... 352.Rxlen R/O Property
©2000-2008 Tibbo Technology Inc.
.......................................................................................................................................................... 353.Send Method
.......................................................................................................................................................... 353.Setdata Method
.......................................................................................................................................................... 354.Setsendinband Method
.......................................................................................................................................................... 354Sinkdata Property
.......................................................................................................................................................... 355.Splittcppackets Property
.......................................................................................................................................................... 355.State R/O Property
.......................................................................................................................................................... 358.Statesimple R/O Property
.......................................................................................................................................................... 359.Targetbcast Property
.......................................................................................................................................................... 359.Targetinterface Property
.......................................................................................................................................................... 359.Targetip Property
.......................................................................................................................................................... 360.Targetport Property
.......................................................................................................................................................... 360.Toutcounter R/O property
.......................................................................................................................................................... 361.Tx2buffrq Method
.......................................................................................................................................................... 362.Tx2len R/O Property
.......................................................................................................................................................... 362.Txbuffrq Method
.......................................................................................................................................................... 363.Txbuffsize R/O Property
.......................................................................................................................................................... 363.Txclear Method
.......................................................................................................................................................... 363.Txfree R/O Property
.......................................................................................................................................................... 364.Txlen R/O Property
.......................................................................................................................................................... 364.Urlsubstitutes
.......................................................................................................................................................... 365.Varbuffrq Method
............................................................................................................................................................... 365IO Object
............................................................................................................................................................ 365Overview
.......................................................................................................................................................... 366Line/Port Manipulation With Pre-selection
.......................................................................................................................................................... 367Line/Port Manipulation Without Pre-selection
.......................................................................................................................................................... 368Controlling Output Buffers
.......................................................................................................................................................... 369Working With Interrupts
............................................................................................................................................................ 370Properties, Events, Methods
.......................................................................................................................................................... 370.Enabled Property (Selected Platforms Only)
.......................................................................................................................................................... 370.Intenabled Property
.......................................................................................................................................................... 371.Intnum Property
.......................................................................................................................................................... 371.Invert Method
.......................................................................................................................................................... 371.Lineget Method
.......................................................................................................................................................... 372.Lineset Method
.......................................................................................................................................................... 372.Num Property
.......................................................................................................................................................... 373On_io_int Event
.......................................................................................................................................................... 373.Portenabled Property (Selected Platforms Only)
.......................................................................................................................................................... 373.Portget Method
.......................................................................................................................................................... 374.Portnum Property
.......................................................................................................................................................... 374.Portset Method
.......................................................................................................................................................... 375.Portstate property
.......................................................................................................................................................... 375.State Property
............................................................................................................................................................... 375Romfile Object
............................................................................................................................................................ 377.Find Method
............................................................................................................................................................ 378.Getdata Method
............................................................................................................................................................ 378.Offset R/O Property
............................................................................................................................................................ 379.Open Method
............................................................................................................................................................ 379.Pointer Property
............................................................................................................................................................ 379.Size R/O Property
............................................................................................................................................................... 380Stor Object
............................................................................................................................................................ 381.Base Property
............................................................................................................................................................ 381.Getdata Method (previously .Get)
............................................................................................................................................................ 382.Setdata Method (previously .Set)
............................................................................................................................................................ 383.Size R/O Property
............................................................................................................................................................... 384Pat Object
............................................................................................................................................................ 385.Channel Property
............................................................................................................................................................ 385.Greenmap Property
............................................................................................................................................................ 386On_pat Event
............................................................................................................................................................ 386.Play Method
XContents
©2000-2008 Tibbo Technology Inc.
TIDE and Tibbo BASIC User ManualXI
............................................................................................................................................................ 387.Redmap Property
............................................................................................................................................................... 387Beep Object
............................................................................................................................................................ 388.Divider Property
............................................................................................................................................................ 388On_beep Event
............................................................................................................................................................ 389.Play Method
............................................................................................................................................................... 389RTC Object
............................................................................................................................................................ 390.Getdata Method (Previously .Get)
............................................................................................................................................................ 391.Running R/O Property
............................................................................................................................................................ 391.Setdata Method (Previously .Set)
............................................................................................................................................................... 392LCD Object
............................................................................................................................................................ 393Overview
.......................................................................................................................................................... 393Understanging Controller Properties
.......................................................................................................................................................... 395Preparing the Display for Operation
.......................................................................................................................................................... 395Working With Pixels and Colors
.......................................................................................................................................................... 396Lines, Rectangles, and Fills
.......................................................................................................................................................... 397Working With Text
....................................................................................................................................................... 400Raster Font File Format
.......................................................................................................................................................... 404Displaying Images
.......................................................................................................................................................... 405Improving Graphical Performance
............................................................................................................................................................ 408Supported Controllers/Panels
.......................................................................................................................................................... 408Samsung S6B0108 (Winstar WG12864F)
.......................................................................................................................................................... 410Solomon SSD1329 (Ritdisplay RGS13128096)
.......................................................................................................................................................... 411Himax HX8309 (Ampire AM176220)
............................................................................................................................................................ 412Properties and Methods
.......................................................................................................................................................... 414.Backcolor Property
.......................................................................................................................................................... 414.Bitsperpixel R/O Property
.......................................................................................................................................................... 415.Bluebits R/O Property
.......................................................................................................................................................... 415.Bmp Method
.......................................................................................................................................................... 416.Enabled Property
.......................................................................................................................................................... 417.Error R/O Property
.......................................................................................................................................................... 417.Fill Method
.......................................................................................................................................................... 418.Filledrectangle Method
.......................................................................................................................................................... 418.Fontheight R/O Property
.......................................................................................................................................................... 419.Fontpixelpacking R/O Property
.......................................................................................................................................................... 419.Forecolor Property
.......................................................................................................................................................... 420.Getprintwidth Method
.......................................................................................................................................................... 420.Greenbits R/O Property
.......................................................................................................................................................... 421.Height Property
.......................................................................................................................................................... 421.Horline Method
.......................................................................................................................................................... 422.Inverted Property
.......................................................................................................................................................... 422.Iomapping Property
.......................................................................................................................................................... 422.Line Method
.......................................................................................................................................................... 423.Linewidth Property
.......................................................................................................................................................... 423.Lock Method
.......................................................................................................................................................... 424.Lockcount R/O Property
.......................................................................................................................................................... 424.Paneltype R/O Property
.......................................................................................................................................................... 425.Pixelpacking R/O Property
.......................................................................................................................................................... 425.Print Method
.......................................................................................................................................................... 426.Printaligned Method
.......................................................................................................................................................... 427.Rectangle Method
.......................................................................................................................................................... 427.Redbits R/O Property
.......................................................................................................................................................... 428.Rotated Property
.......................................................................................................................................................... 428.Setfont Method
.......................................................................................................................................................... 429.Setpixel Method
.......................................................................................................................................................... 429.Textalignment Property
.......................................................................................................................................................... 430.Texthorizontalspacing Property
.......................................................................................................................................................... 430.Textorientation Property
.......................................................................................................................................................... 431.Textverticalspacing Property
.......................................................................................................................................................... 431.Unlock Method
©2000-2008 Tibbo Technology Inc.
.......................................................................................................................................................... 432.Verline Method
.......................................................................................................................................................... 432.Width Property
............................................................................................................................................................... 433Fd Object
............................................................................................................................................................ 433Overview
.......................................................................................................................................................... 434Sharing Flash Between Your Application and Data
.......................................................................................................................................................... 435Fd. Object's Status Codes
.......................................................................................................................................................... 436File-based Access
....................................................................................................................................................... 436Formatting the Flash Disk
....................................................................................................................................................... 437Disk Area Allocation Details
....................................................................................................................................................... 439Mounting the Flash Disk
....................................................................................................................................................... 440File Names and Attributes
....................................................................................................................................................... 441Checking Disk Vitals
....................................................................................................................................................... 441Creating, Deleting, and Renaming Files
....................................................................................................................................................... 442Reading and Writing File Attributes
....................................................................................................................................................... 442Walking Through File Directory
....................................................................................................................................................... 443Opening Files
....................................................................................................................................................... 444Writing To and Reading From Files
....................................................................................................................................................... 445Removing Data From Files
....................................................................................................................................................... 446Searching Files
....................................................................................................................................................... 448Closing Files
.......................................................................................................................................................... 448Direct Sector Access
....................................................................................................................................................... 450Using Checksums
....................................................................................................................................................... 452Upgrading the Firmware/Application
.......................................................................................................................................................... 453File-based and Direct Sector Access Coexistence
.......................................................................................................................................................... 453Prolonging Flash Memory Life
.......................................................................................................................................................... 454Ensuring Disk Data Integrity
............................................................................................................................................................ 456Properties and Methods
.......................................................................................................................................................... 457.Availableflashspace R/O Property
.......................................................................................................................................................... 458.Buffernum Property
.......................................................................................................................................................... 458.Capacity R/O Property
.......................................................................................................................................................... 459.Checksum Method
.......................................................................................................................................................... 460.Close Method
.......................................................................................................................................................... 460.Copyfirmware Method
.......................................................................................................................................................... 461.Cutfromtop Method
.......................................................................................................................................................... 462.Create Method
.......................................................................................................................................................... 463.Delete Method
.......................................................................................................................................................... 463.Filenum Property
.......................................................................................................................................................... 464.Fileopened R/O Property
.......................................................................................................................................................... 464.Filesize R/O Property
.......................................................................................................................................................... 464.Find Method
.......................................................................................................................................................... 466.Flush Method
.......................................................................................................................................................... 467.Format Method
.......................................................................................................................................................... 467.Getattributes Method
.......................................................................................................................................................... 468.Getbuffer Method
.......................................................................................................................................................... 469.Getdata Method
.......................................................................................................................................................... 470.Getfreespace Method
.......................................................................................................................................................... 470.Getnextdirmember Method
.......................................................................................................................................................... 471.Getnumfiles Method
.......................................................................................................................................................... 472.Getsector Method
.......................................................................................................................................................... 472.Laststatus R/O Property
.......................................................................................................................................................... 473.Maxopenedfiles R/O Property
.......................................................................................................................................................... 474.Maxstoredfiles R/O Property
.......................................................................................................................................................... 474.Mount Method
.......................................................................................................................................................... 475.Numservicesectors R/O Property
.......................................................................................................................................................... 475.Open Method
.......................................................................................................................................................... 476.Pointer R/O Property
.......................................................................................................................................................... 476.Ready R/O Property
.......................................................................................................................................................... 477.Rename Method
.......................................................................................................................................................... 478.Resetdirpointer Method
XIIContents
©2000-2008 Tibbo Technology Inc.
TIDE and Tibbo BASIC User ManualXIII
.......................................................................................................................................................... 478.Sector R/O Property
.......................................................................................................................................................... 478.Setattributes Method
.......................................................................................................................................................... 479.Setbuffer Method
.......................................................................................................................................................... 480.Setdata Method
.......................................................................................................................................................... 481.Setfilesize Method
.......................................................................................................................................................... 482.Setpointer Method
.......................................................................................................................................................... 483.Setsector Method
.......................................................................................................................................................... 483.Totalsize R/O Property
............................................................................................................................................................... 484Kp Object
............................................................................................................................................................ 484Possible Keypad Configurations
............................................................................................................................................................ 486Key States and Transitions
............................................................................................................................................................ 487Preparing the Keypad for Operation
............................................................................................................................................................ 489Servicing Keypad Events
............................................................................................................................................................ 492Properties, Methods, Events
.......................................................................................................................................................... 492.Autodisablecodes Property
.......................................................................................................................................................... 492.Enabled Property
.......................................................................................................................................................... 493.Longpressdelay Property
.......................................................................................................................................................... 493.Longreleasedelay Property
.......................................................................................................................................................... 494On_kp Event
.......................................................................................................................................................... 494On_kp_overflow Event
.......................................................................................................................................................... 495.Pressdelay Property
.......................................................................................................................................................... 495.Releasedelay Property
.......................................................................................................................................................... 496.Repeatdelay Property
.......................................................................................................................................................... 496.Returnlinesmapping Property
.......................................................................................................................................................... 497.Scanlinesmapping Property
............................................................................................................................................................... 497Wln Object
............................................................................................................................................................ 498Migrating From the WA1000
............................................................................................................................................................ 499Overview
.......................................................................................................................................................... 500Wi-Fi Parlance Primer
.......................................................................................................................................................... 500Wln Tasks
.......................................................................................................................................................... 503Wln State Transitions
.......................................................................................................................................................... 504Brining Up Wi-Fi Interface
....................................................................................................................................................... 505Allocating Buffer Memory
....................................................................................................................................................... 506Applying Reset
....................................................................................................................................................... 507Configuring Interface Lines
....................................................................................................................................................... 507Setting MAC Address (Optional)
....................................................................................................................................................... 508Selecting Domain
....................................................................................................................................................... 508Booting Up the Hardware
....................................................................................................................................................... 509Setting IP, Gateway, and Netmask (Optional)
....................................................................................................................................................... 509Setting TX Power (Optional)
.......................................................................................................................................................... 509Scanning for Wi-Fi Networks
.......................................................................................................................................................... 510Setting WEP Mode and Key
.......................................................................................................................................................... 511Associating With Selected Network
.......................................................................................................................................................... 512Creating Own Ad-hoc Network
.......................................................................................................................................................... 512Communicating via Wln Interface
.......................................................................................................................................................... 512Disassociating From the Network
.......................................................................................................................................................... 512Terminating Own Ad-hoc Network
.......................................................................................................................................................... 513Rebooting
.......................................................................................................................................................... 513Detecting Disassociation or Offline State
............................................................................................................................................................ 513Properties, Methods, Events
.......................................................................................................................................................... 513.Associate Method
.......................................................................................................................................................... 514.Associationstate R/O Property
.......................................................................................................................................................... 515.Boot Method
.......................................................................................................................................................... 515.Bssmode Property
.......................................................................................................................................................... 516.Buffrq Method
.......................................................................................................................................................... 516.Buffsize R/O Property
.......................................................................................................................................................... 517.Clkmap Property
.......................................................................................................................................................... 517.Csmap Property
.......................................................................................................................................................... 517.Defaultibsschannel Property
©2000-2008 Tibbo Technology Inc.
.......................................................................................................................................................... 517.Dimap Property
.......................................................................................................................................................... 518.Disassociate Method
.......................................................................................................................................................... 518.Domain Property
.......................................................................................................................................................... 519.Domap Property
.......................................................................................................................................................... 519.Enabled R/O Property
.......................................................................................................................................................... 520.Gatewayip Property
.......................................................................................................................................................... 520.Ip Property
.......................................................................................................................................................... 520.Mac Property
.......................................................................................................................................................... 521.Netmask Property
.......................................................................................................................................................... 521.Networkstart Method
.......................................................................................................................................................... 522.Networkstop Method
.......................................................................................................................................................... 522On_wln_event Event
.......................................................................................................................................................... 523On_wln_task_complete Event
.......................................................................................................................................................... 524.Rssi R/O Property
.......................................................................................................................................................... 524.Scan Method
.......................................................................................................................................................... 525.Scanresultbssid R/O Property
.......................................................................................................................................................... 525.Scanresultbssmode R/O Property
.......................................................................................................................................................... 526.Scanresultchannel R/O Property
.......................................................................................................................................................... 526.Scanresultrssi R/O Property
.......................................................................................................................................................... 526.Scanresultssid R/O Property
.......................................................................................................................................................... 527.Settxpower Method
.......................................................................................................................................................... 527.Setwep Method
.......................................................................................................................................................... 528.Ssid Property
.......................................................................................................................................................... 528.Task R/O Property
.......................................................................................................................................................... 529.Wepkey1 Property
.......................................................................................................................................................... 529.Wepkey2 Property
.......................................................................................................................................................... 529.Wepkey3 Property
.......................................................................................................................................................... 529.Wepkey4 Property
.......................................................................................................................................................... 530.Wepmode Property
XIVContents
Update History (for this Manual) 530
©2000-2008 Tibbo Technology Inc.
1 TIDE and Tibbo BASIC User Manual

Taiko R2

Taiko is a solution which allows you to create programs for Tibbo modules capable of running TiOS (Tibbo Operating System), and products based on these modules.
With Taiko, you write your program in a language called Tibbo Basic (a close relative of any other BASIC you might already know), using a PC software called TIDE - Tibbo Integrated Development Environment. Your program is then compiled into a binary file and uploaded onto a Tibbo module. The Virtual Machine of TiOS then executes this binary.
Taiko allows you to easily create programs for a variety of Tibbo-based products. These may include:
Alarm Panels
Security Systems (Access control terminals, etc)
Data Collection terminals, such as time clocks
Sensor monitors
Interface converters
Vending machines
Industrial process controllers
The solutions created with Taiko are very flexible. They are written using a language similar to BASIC, and are stored on a Tibbo module separately from the core OS of the module (TiOS). This allows for simple modification of your device functionality, even by the end-user (if you so allow).
Tibbo Basic itself is exactly the same for all TiOS-enabled devices. Hardware differences are expressed through so-called platforms. Change the platform, and you're programming for a different device.
Last update: 29JUL2009

Legal Information

Manual Update History
1
530
Documentation Map
The documentation for Taiko includes:
Overview - The theory and background behind Taiko.
4
Getting Started - An example starter project.
Programming with TIDE -- An overview of TIDE itself, debug facilities, etc.
Language Reference -- Systematically covers Tibbo Basic statements, keywords
and operators.
Development Environment -- Systematically covers TIDE GUI elements.
Glossary of Terms -- Contains some basic terms used in Taiko.
Platforms -- Platform-specific documentation for each target device.
133
Legal Information
Tibbo Technology ("TIBBO") is a Taiwan corporation that designs and/or manufactures a number of hardware products, software products, and applications ("PRODUCTS"). In many cases, Tibbo PRODUCTS are combined with each other
9
15
78
113
131
©2000-2008 Tibbo Technology Inc.
2Taiko R2
and/or third-party products thus creating a PRODUCT COMBINATION.
Whereas you (your Company) wish to purchase any PRODUCT from TIBBO, and/or whereas you (your Company) wish to make use of any documentation or technical information published by TIBBO, and/or make use of any source code published by TIBBO, and/or consult TIBBO and receive technical support from TIBBO or any of its employees acting in an official or unofficial capacity,
You must acknowledge and accept the following disclaimers:
1. Tibbo does not have any branch office, affiliated company, or any other form of presence in any other jurisdiction. TIBBO customers, partners and distributors in Taiwan and other countries are independent commercial entities and TIBBO does not indemnify such customers, partners or distributors in any legal proceedings related to, nor accepts any liability for damages resulting from the creation, manufacture, importation, advertisement, resale, or use of any of its PRODUCT or PRODUCT COMBINATION.
2. BASIC-programmable devices ("PROGRAMMABLE DEVICES") manufactured by TIBBO can run a variety of applications written in Tibbo BASIC ("BASIC APPLICATIONS"). Combining a particular PROGRAMMABLE DEVICE with a specific BASIC APPLICATION, either written by TIBBO or any third party, may potentially create a combinatorial end product (”END PRODUCT”) that violates local rules, regulations, and/or infringes an existing patent granted in a country where such combination has occurred or where the resulting END PRODUCT is manufactured, exported, advertised, or sold. TIBBO is not capable of monitoring any activities by its customers, partners or distributors aimed at creating any END PRODUCT, does not provide advice on potential legal issues arising from creating such END PRODUCT, nor explicitly recommends the use of any of its PROGRAMMABLE DEVICES in combination with any BASIC APPLICATION, either written by TIBBO or any third party.
3. TIBBO publishes a number of BASIC APPLICATIONS and segments thereof ("CODE SNIPPETS").
The BASIC APPLICATIONS and CODE SNIPPETS are provided “as is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of BASIC APPLICATIONS and CODE SNIPPETS resides with you. BASIC APPLICATIONS AND CODE SNIPPETS may be used only as a part of a commercial device based on TIBBO hardware. Modified code does not have to be released into the public domain, and does not have to carry a credit for TIBBO. BASIC APPLICATIONS and CODE SNIPPETS are provided solely as coding aids and should not be construed as any indication of the predominant, representative, legal, or best mode of use for any PROGRAMMABLE DEVICE.
4. BASIC-programmable modules ("PROGRAMMABLE MODULES"), such as the EM1000 device,
are shipped from TIBBO in either a blank state (without any BASIC APPLICATION loaded), or with a simple test BASIC APPLICATION aimed at verifying correct operation of PROGRAMMABLE MODULE's hardware. All other BASIC-programmable products including boards, external controllers, and developments systems ("NON-MODULE PRODUCTS"), such
©2000-2008 Tibbo Technology Inc.
3 TIDE and Tibbo BASIC User Manual
as the DS1000 and NB1000, are normally shipped with a BASIC APPLICATION pre-loaded. This is done solely for the convenience of testing by the customer and the nature and function of pre-loaded BASIC APPLICATION shall not be construed as any indication of the predominant, representative, or best mode of use for any such NON-MODULE PRODUCT.
5. All specifications, technical information, and any other data published by TIBBO are subject to change without prior notice. TIBBO assumes no responsibility for any errors and does not make any commitment to update any published information.
6. Any technical advice provided by TIBBO or its personnel is offered on a purely technical basis,
does not take into account any potential legal issues arising from the use of such advice, and should not be construed as a suggestion or indication of the possible, predominant, representative, or best mode of use for any Tibbo PRODUCT.
7. Neither TIBBO nor its employees shall be held responsible for any damages resulting from the
creation, manufacture, or use of any third-party product or system, even if this product or system was inspired, fully or in part, by the advice provided by Tibbo staff (in an official capacity or otherwise) or content published by TIBBO or any other third party.
8. TIBBO reserves the right to halt the production or availability of any of its PRODUCTS at any time and without prior notice. The availability of a particular PRODUCT in the past is not an indication of the future availability of this PRODUCT. The sale of the PRODUCT to you is solely at TIBBO's discretion and any such sale can be declined without explanation.
9. TIBBO makes no warranty for the use of its PRODUCTS, other than that expressly contained in the Standard Warranty located on the Company's website. Your use of TIBBO PRODUCTS is at your sole risk. TIBBO PRODUCTS are provided on an "as is" and "as available" basis. TIBBO expressly disclaims the warranties of merchantability, future availability, fitness for a particular purpose and non-infringement. No advice or information, whether oral or written, obtained by you from TIBBO shall create any warranty not expressly stated in the Standard Warranty.
10.LIMITATION OF LIABILITY. BY USING TIBBO PRODUCTS YOU EXPRESSLY AGREE THAT TIBBO SHALL NOT BE LIABLE TO YOU FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, OR OTHER INTANGIBLE LOSSES (EVEN IF TIBBO HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES) RESULTING FROM THE USE OR THE INABILITY TO USE OF TIBBO PRODUCTS.
11."Tibbo" is a registered trademark of Tibbo Technology, Inc.
12.Terms and product names mentioned on TIBBO website or in TIBBO documentation may be trademarks of others.
©2000-2008 Tibbo Technology Inc.

Overview

Below is a summary of the major fundamentals and theory behind TIDE. This may sound intimidating, but it's actually quite simple. You should at least skim over the material herein, because it explains much of what comes next. In here you will find:
Our Language Philosophy
System Components
Objects (a very brief overview)
Events
8
8

Our Language Philosophy

Several principles have guided us through the development process of Tibbo Basic. Understanding them would help you understand this manual better, and also the language itself. See below:
A Bit of History
Years ago, programming for the PC was the nearly exclusive domain of engineers. The languages traditionally available, such as C, simply required you to be an engineer to program.
However, one day something interesting happened. Visual Basic* and Delphi** saw the light of day. And that changed quite a lot on the PC front. Suddenly, people who were not engineers were finding out that they could actually create something cool on their PC. You could say VB* and Delphi democratized the PC software market.
The situation on the embedded systems market today is quite similar to the situation which existed for the PC market in the pre-VB era. Many embedded systems vendors do offer customizable or programmable solutions -- but to implement those solutions, you would really have to be an engineer and know C/C ++ quite well. So, there was clearly a need for an easy-to-use programming system which would democratize this market, as well.
7
4Overview
4
Principle One: Easy To Write, Easy to Debug
Choosing BASIC as our inspiration was the natural thing to do, for us. It's a language which doesn't require you to be a professional engineer. It is easy to understand. This is why it is embedded into many non-programmer products, such as the Office suite. So we went for BASIC.
Another part of the user experience, and a major one, too, is debugging. Writing your application is just half the job. You also need to debug it and for embedded systems, this is where things typically start getting rough around the edges. Many times you have to buy expensive tools, such as ICE machines (In-Circuit Emulators), just to figure out what your code is doing. Sometimes you don't even have the luxury of such a machine, and you actually debug by guessing and trying different things in your code.
With our system, one of our major goals was to offer a user experience which is close to debugging on the PC -- without the need for special tools, such as an ICE machine.
While your program is running on the target (embedded device), you actually see how it runs on your PC. You can step through it, jump to specific functions, check values of variables etc -- all from the comfort of your own PC.
©2000-2008 Tibbo Technology Inc.
5 TIDE and Tibbo BASIC User Manual
Principle Two: Easy Doesn't Mean Sloppy
Some modern programming languages use certain techniques to make life 'easier' for programmers. They might not require the programmer to explicitly declare the variables he's going to use ('implicit declaration'), or might do away with the need to specify the type for the variable (i.e, use 'variant variables' which can contain anything).
This has several disadvantages. For one, it is just sloppy. After several days of writing code like that, a programmer might not have a very clear-cut idea of what his program is doing, or where things come from. While this is something which may be subject to debate, the next disadvantage is quite real:
This is simply wasteful programming. These techniques can consume quite a lot of resources, specifically memory. On the PC, a variant used to store just 2 bytes of data might take up to 100 bytes. This isn't a problem, because PCs have so much memory these days that it is barely felt.
However, embedded systems are often low-cost and bare-bones, so physical memory is a truly valuable resource. Waste too much of it -- and you would find that your code can do very little. But manage it prudently, and your code will be capable of quite impressive feats even on your 'low-power' embedded system.
So our systems requires you to be more organized. The effort is worth it.
Principle Three: The Purity of Language
Programming systems on the PC usually make no clear distinction between the 'pure' language constructs which perform calculations and control program flow, and hardware-dependant input/output. For example, many languages contain a print statement which prints something to the screen.
Since all PCs in the world are similar, this works. However, this makes little sense for embedded platform, which have vastly different input/output resources. Depending on the device, it may or may not have a screen, a serial port, networking etc etc.
In our system, we separated the language itself (what we call the core language) from the input/output of a particular device. Thus, the language itself remains the same, no matter what device you are programming for. The input/output part is hardware dependant, and changes from platform to platform.
When writing for a specific platform, you are provided with a set of platform­specific objects. These provide rich functionality and allow you to do 'real' work, such as printing messages to the serial port, communicating on the Internet or controlling motors and sensors.
Ideally, Tibbo Basic could run on a fridge just as well as it could run on a time and attendance terminal.
Principle Four: Thin and Agile
A lot of embedded systems are built by scaling down larger desktop systems, and it shows. What's the point of using a super-fast processor if you load it with dozens of layers of nested calls?
All the code TiOS includes has been designed from scratch for running on a very simple processor, and optimized for control applications. It has been crafted to have the minimum possible ROM and RAM footprint and to run as fast as possible.
We built TiOS with Pareto's principle in mind. In other words, if a certain functionality is required by only 5% of applications and yet its existence adds 90% overhead, we did not include it. For example, our BASIC only supports integer
©2000-2008 Tibbo Technology Inc.
6Overview
calculations. Most other BASIC versions, by default, operate using floating point arithmetic, but these are not usually useful to embedded control (and even get in the way). Another decision was to use a static memory model for procedure variables. Memory is not allocated and deallocated dynamically -- It is assigned on compile-time, which results in great performance improvements.
Principle Five: No B.S
... that is, no babysitting. Development systems intended for rapid application development on the PC will often try to handle every little error or problem the programmer may encounter. If a variable overflows, for example, they will halt execution and pop up an error to let him know. This makes sense for a PC-based product, because you are right there to see it halt.
However, when you are creating an embedded system, you expect it to run at all times, without halting. Nobody will be there to see any errors and babysit your system. Your device is simply expected to work.
This is a major difference also for the development process. In essence, since the whole language is built this way, you will also get much less errors even when doing seemingly 'strange' things, such as putting large values into variables that cannot hold them. The language will deal with it silently, in a very predictable and logical way -- but will not pop up an error.
Principle Six: Event-Driven Programming
Users of VB and Delphi and other Windows-based tools will find this principle familiar. However, if most of your experience with BASIC was under DOS, you might find this slightly odd. Under DOS, you would expect a program to begin from the beginning, then continue and stop. They execute from top to bottom. This may be called linear execution.
For Tibbo Basic, this is not the case. The programs you will write will be event- driven. Your program will consist of a number of event handlers which will be fired (invoked) in response to specific things which happen to your system in real life. If your platform was a fridge, you might want to write a handler for a 'door opening' event. When the door is opened, an event is generated, and an event handler, with your code in it, is fired.
So, you could say that your event-driven application has no beginning and no end. Event handlers are called when events are generated, and in the order in which they were generated.
* Windows, Visual Basic and VB are registered trademarks of Microsoft Corporation Inc.
** Delphi is a registered trademark of Borland Inc.
©2000-2008 Tibbo Technology Inc.
7 TIDE and Tibbo BASIC User Manual

System Components

Taiko is a compound system. It consists of the following components:
TIDE is an acronym for Tibbo Integrated Development Environment. This is the PC program in which you will write your applications and compile them, and from which you will upload them to your target and debug them.
The compiler is a utility program, used by TIDE. The compiler processes your project files and creates an executable binary file (with a .tpc suffix, for Tibbo PCode).
The target is a separate hardware device, on which your program actually runs. When debugging code, it is connected to your computer running TIDE (see the link above) and TIDE can monitor and control it. This is called cross-debugging.
As covered under Our Language Philosophy , Tibbo Basic is capable of running on various hardware devices. Each type of hardware device on which Tibbo Basic runs is called a platform.
And now, the anatomy of the target:
4
The target runs an operating system called TiOS (Tibbo Operating System).
TiOS runs two processes. One is the Master Process. This is the process which is in charge of communications (including communications with TIDE) and of generating events. The second process, which is under the control of the Master Process, is called the VM (Virtual Machine).
The VM is what actually executes your application. In essence, the VM is a processor implemented in firmware, which executes the compiled form of your application. The instructions it understands are called P-Code, which is short for pseudo-code. This is what the compiler produces. It is called pseudo-code because
©2000-2008 Tibbo Technology Inc.
it is not native binary code which the hardware processor can understand directly; instead, it is interpreted by the VM.
Since the VM is under the complete control of the Master Process, the actual hardware processor will not crash because of an error in your Tibbo Basic application. Your application may operate incorrectly, but you still will be able to debug it. The Master Process can stop or restart the Virtual Machine at will, and can exchange debug information with TIDE, such as report current execution state, variable values, etc.
Simply put, you can think of the VM as a sort of a 'sandbox' within the processor. Your application can play freely, without the possibility of crashing or stalling TiOS due to some error.
The queue is used to 'feed' your program with events which it should handle. The Master Process monitors the various interfaces of the platform and generates events, putting them into the queue. The Virtual Machine extracts these events from the other side of the queue and feeds your program with them. Various parts of your program execute in response to events.

Objects

Objects represent the various component part of your platform. For example, a platform with a serial port might have a ser object. A platform can be described as a collection of objects.
Under Tibbo Basic, the set of object you get for each platform is fixed. You cannot add new objects or create multiple instances of the same object.
Objects have properties, methods and events. A property can be likened to an attribute of the object, and a method is an action that the object can perform.
Events are described in the next section.
Objects are covered in further detail under Objects, Events and Platform Functions
78
8Overview
8
8
.

Events

An event is something which happens to an object. Plain and simple. A fridge might have door object with an on_door_open event, and a paper shredder might have a detector object with an on_paper_detected event.
Events are a core concept in Tibbo Basic. They are the primary way in which code gets executed.
The target device maintains an event queue. All events registered by the system go into this queue. On the other end of the queue, the Virtual Machine takes out one event at a time and calls an event handler for each event.
Event handlers are subroutines in your code which are 'fired' (executed) to handle an event. Often, event handlers contain function calls which run other parts of the program.
While processing an event, other events may happen. These events are then queued for processing, and patiently wait for the first event to complete before beginning execution.
All Tibbo Basic programs are single-threaded, so there is only one event queue. All events are executed in the exact order in which they were queued.
It may sometimes seem that some events should get priority over other events. This functionality is not supported under Tibbo Basic. This is not crucial, as events
©2000-2008 Tibbo Technology Inc.
9 TIDE and Tibbo BASIC User Manual
This project would actually run also on the EM202, EM200 and EM120 modules. However, these modules cannot work on their own, and you cannot easily test with them.
Of course, once you upload a device with the TiOS firmware, it is no longer a Device Server! So you cannot see it under DS Manager. You could program it so it would respond to DS Manager -- but by default it is a 'clean slate', and does not respond to DS Manager broadcasts.
tend to execute very quickly, and the queue ensures events are not forgotten.

Getting Started

Below is a walk-through for a starter project which is written specifically for the EM202-EV and DS202.
Once you are done with this project, you will be able to press the button on the EM202-EV or DS202 and watch the LEDs blink "Hello World!" in Morse code.

Preparing Your Hardware

Preparing a DS202
Before starting to use TIDE, you should upload the correct firmware to a DS202. Perform the following steps:
Get tios_EM202_xxx.bin firmware file (the latest version) from the Tibbo
website. _100 in this filename stands for version 1.00, for example.
Connect the DS202 to power (preferably, use adaptor supplied by Tibbo).
Connect the DS using a network cable (WAS-1499 or similar) to the same hub
your computer is connected to, or directly to the computer with a cross network cable (WAS-1498 or similar).
Make sure your local firewall (such as the XP SP2 firewall) is disabled or does not
block broadcast UDP messages. This is essential for communications between TIDE and the DS202 while debugging.
Run Device Explorer (Start > Programs > Tibbo > Tibbo IDE > Device Explorer).
You should see your device on the list. Select it.
Click Upload > Load Firmware Through the Network.
Select the firmware file, and click OK.
The firmware will now be uploaded.
For some firmware versions, you now have to manually reboot the DS
(Disconnect and reconnect the power cable). The red Status LED should now blink rapidly. This is OK -- it means the TiOS firmware is loaded and the application program memory is empty.
Proceed to Starting a New Project .
10
©2000-2008 Tibbo Technology Inc.
If for some reason you cannot perform a network upload, you can perform a serial upload by selecting Upload > Load firmware Through the Serial Port. You will then be prompted to select a COM port, turn the device off and turn it back on while pressing the SETUP button. Upload will then commence.

Starting a New Project

To begin a new project, select File > New. You will be presented with the following dialog:
10Getting Started
Platform: Select EM202 (you can use EM1000 as well)
Available project types: Select Empty Project.
Project name: Type 'Hello World'.
Location: Leave untouched, unless you have a good reason to change it.
Transport: leave it as is ("Taiko UDP Broadcast Transport")
Target Address: Click Browse. You will be presented with the following dialog:
©2000-2008 Tibbo Technology Inc.
11 TIDE and Tibbo BASIC User Manual
If you see nothing in this dialog, it means your target isn't in communication with the computer. This is probably a power problem, or a networking problem. Perhaps you have a local firewall on the computer which blocks UDP broadcasts, such as the Windows XP Firewall. To fix this, disable the firewall or configure it to open a specific port.
The number (hopefully) displayed is the MAC address of your target. If you select it and click Buzz, you should see the LED pattern on your target switch off momentarily. This means it is correctly detected.
Once you have located your target, click Select. You will be returned to the previous dialog, and the MAC address for your target will appear under Target Address.
You have now specified all of the required settings for a new project. Click OK and proceed.

Writing Code

Once you have started your new project, you will be presented with a blank file (main.tbs).
We will now begin writing the actual code in this file. We will construct this project from beginning to end, step by step. For your convenience, the end of this section contains a complete copy of the project without comments. You can copy and paste the whole thing into TIDE, or just copy and paste the commented sections one by one as they appear below.
Here goes:
©2000-2008 Tibbo Technology Inc.
12Getting Started
' Comments cannot spill over to the next line. If you see this happening in this manual, it is a result of the help system -- not an actual feature.
Dim hello_world As String ' define a variable which will hold the whole
pattern we will play.
Dim length, play_position As Integer ' length is a calculated integer
which will contain the whole length of the string we will play, and play_position will contain our current position in this string (how much we have played so far).
Const PAT_PLAY_CHUNK_LENGTH = 15 ' define a constant for the size of the
chunk we will play. We will play one chunk of the pattern at a time, and then move on to the next chunk. Each chunk is 15 'steps' long.
Declare Sub play_Next ' let the compiler know that there is a sub called
play_next. This sub will be used in code before being created so we must declare it.
sub on_sys_init ' event handler for the init event. Fires whenever the
device powers on.
hello_world = ' here we define the contents of our string, in morse.
'R is Red LED, G is Green LED. GGG means a long pulse of the green LED (line). R means a short pulse of the Red LED (dot). Line (-) means both off.
'HELLO .... . .-.. .-.. ---
"R-R-R-R---R---R-GGG-R-R---R-GGG-R-R---GGG-GGG-GGG" +
"-------" + ' A period of silence between words
'WORLD .-- --- .-. .-.. -..
"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) ' Calculate total length of string.
play_position = 1 ' Initialize play_position as we haven't played
anything yet.
end sub
Notice that we are defining a chunk above. The reason for this is that we are going to play quite a long and complex pattern (over 130 steps in length), but the pattern object (pat.) used to play the pattern only supports patterns of up to 16 steps. So we have to play our pattern in parts, one after the other, and track our progress through the pattern (this is what the counters are for).
So far, we have prepared the ground. Let us move to the first piece of executable code:
©2000-2008 Tibbo Technology Inc.
We will now write the event handlers for our code.
First, we want the pattern to start playing whenever you press the button. For this, our platform offers a button object, which generates an on_button_pressed event. Instead of typing, you can create the event handler for this event by double­clicking on the event name in the project tree .
130
13 TIDE and Tibbo BASIC User Manual
sub on_button_pressed ' event handler fired whenever the button is pressed
play_position = 1 ' start playing from the beginning of the pattern
play_next ' call the routine which plays the next chunk (the first
chunk, in this case)
end sub
sub on_pat ' this fires whenever a pattern (a chunk, in our case)
finishes playing.
play_next ' call the routine which plays the next chunk
end sub
sub play_next ' plays the next chunk of our large pattern.
if length < play_position then exit sub ' if we have reached the end
of the pattern, stop.
dim chunk_len as integer ' internal integer for the length of current
chunk to be played.
chunk_len = length - play_position + 1 ' calculate how much of the
large string is left.
if chunk_len > PAT_PLAY_CHUNK_LENGTH then chunk_len =
PAT_PLAY_CHUNK_LENGTH ' if too much is left, we bite off only a chunk we
can process.
dim chunk as string ' will contain the chunk which will actually play
now.
chunk = mid(hello_world, play_position, chunk_len) ' chunk is the
part of hello_world which begins at play_position and is as long as chunk_len.
pat.play(chunk, YES) ' Play this chunk. YES means the pattern may be
interrupted -- you can press the button while the pattern is playing, and it will start again from the top.
play_position = play_position + chunk_len ' advance play_position to
account for the chunk we played.
end sub
Notice that the play_next routine is not yet defined. In our code, it is first used and then defined. This is why we have to declare it at the beginning.
Now, let us move on to the next event handler:
We have now completed writing our event handlers. Our program now knows what it's supposed to do whenever you press the button, and whenever a chunk of the pattern finishes playing. It just doesn't know how to do it yet. This comes next:
79
Here is the whole project, without comments:
©2000-2008 Tibbo Technology Inc.
'========================================================================= ====== ' HELLO WORLD IN MORSE CODE (for EM202-EV, DS202) '========================================================================= ======
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
14Getting Started

Building, Uploading and Running

©2000-2008 Tibbo Technology Inc.
Once you are done with writing your project, it is time to build, upload and run it. These three operations can be done by pressing F5.
Press F5 and wait. You will see your project compiling. The output pane will
129
Loading...
+ 530 hidden pages