Do you have a question about the GA1000 and is the answer not in the manual?
Questions and answers
Subscribe to Our Youtube Channel
Summary of Contents for Tibbo GA1000
Page 1
*** USER’S MANUAL *** FCC ID : XOJGA1000...
Page 2
The Federal Communication Commission Statement This equipment has been tested and found to comply with the limits for a Class B Digital Device, pursuant to Part 15 of the FCC rules. These limits are designed to provide reasonable protection against harmful interference in a residential installation.
TIDE and Tibbo BASIC User Manual Table of Contents Taiko R2 Legal Information ........................... 1 Overview Our Language Philosophy ........................... 4 System Components ........................... 7 Objects ................................8 Events ................................8 Getting Started Preparing Your Hardware ........................... 9 Starting a New Project ...........................
Page 9
TIDE and Tibbo BASIC User Manual .Totalbuffpages R/O Property ................................223 .Version R/O Property ................................223 Ser Object ................................224 What's new in V1.1 ................................224 Overview ................................225 Anatomy of a Serial Port ................................225 Three Modes of the Serial Port ................................
Page 11
TIDE and Tibbo BASIC User Manual Working with HTTP Variables ............................... 323 Simple Case (Small Amout of Variable Data) ............................... 323 Complex Case (Large Amount of Variable Data) ............................... 324 Details on Variable Data ............................... 326 Properties, Methods, and Events ................................
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.
Page 18
(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.
Page 19
Tibbo staff (in an official capacity or otherwise) or content published by TIBBO or any other third party.
Events 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.
Page 21
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.
Page 22
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.
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.
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.
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.
TIDE and Tibbo BASIC User Manual 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.
Page 29
TIDE and Tibbo BASIC User Manual on_button_pressed ' event handler fired whenever the button is pressed play_position = ' 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 Notice that the play_next routine is not yet defined.
The topics below attempt to give you a general understanding about working with Tibbo Basic. An attempt has been made to lay them out as logically as possible; it would be advised to just read them from top to bottom and follow the links every time you don't understand a term.
Page 32
HTML files: Multiple files with an .html extension (displayed with the currently associated icon). Contain webpages to be displayed by the embedded webserver. These can include blocks of Tibbo Basic code. See Working with HTML (Any Resource files: Multiple files without any set extension.
TIDE and Tibbo BASIC User Manual Creating, Opening and Saving Projects To create a new project, select File > New. The following dialog will appear: Platform: The platform on which your project will run. Available project types: Various quick-start templates .
Page 35
TIDE and Tibbo BASIC User Manual Specify a name for your file under Filename. If you also specify an extension, the Add as listbox is automatically updated. Automatically recognized file types are: .tbs -- basic files .h -- header files ...
Tibbo Basic compiler but simply used as-is within the project. These files are not modified or compressed in any way; they are merely included...
Page 37
TIDE and Tibbo BASIC User Manual ... or RGB color selector: Double-clicking on the image file with .bmp, .jpg, .png, or .gif extension opens the image editor. All image-related editing functionality is concentrated within Image menu ...and Image Editor toolbar...
TIDE and Tibbo BASIC User Manual procedure is implemented ("gets" a body). Same applies to global variables -- gray icon next to variables that are declared but not yet defined, active icon for defined global variables. Double-clicking on an event which does not yet have an event handler will create an empty event handler procedure for this event at the bottom of the currently active file.
"ser.enabled=" you will get a list of possible values of this property: By pressing Alt+Ctrl+T when the cursor is directly to the right of any meaningful Tibbo Basic construct, you will get a pop-up list with the appropriate contents for the current context. If the cursor isn't...
Page 41
TIDE and Tibbo BASIC User Manual In the code editor, you may also display a tooltip with the keyboard by pressing Ctrl+T when the cursor is within an event handler, a procedure, a constant or a global variable. Tooltip text for properties, methods, and events comes from the platform file for platform selected in your project.
TIDE and Tibbo BASIC User Manual To upload your project, you must select Project > Upload or click the Upload button on the Debug toolbar. Before uploading, TIDE checks if the project has been changed since it was last built. If so, it builds the project again and attempts to upload the new build.
TIDE and Tibbo BASIC User Manual Pause: This message occurs when the Virtual Machine on the target was stopped while not executing code (in other words, it was caught between events). No program pointer is displayed in this state, because no code is being executed.
Floating point error Invalid opcode* Access outside of user memory* Failed to load binary library* *This exception indicates that either TiOS or Tibbo Basic compiler is not functioning properly. Let us know if you encounter this exception! Program Pointer 4.1.8.2 The program pointer is a line, highlighted in yellow, which shows the present location of program execution.
TIDE and Tibbo BASIC User Manual The yellow arrow over the red dot merely marks the program pointer; a breakpoint is always marked by a red dot. Where a Breakpoint May Be Placed A breakpoint may be placed only on a line which contains executable code; before compiling your project, you could place breakpoints anywhere.
TIDE and Tibbo BASIC User Manual A step is an instruction to move the program pointer to another line in source code. Stepping allows you to execute your code in a very controlled way, and work your way along the program in a pace which you can analyze and understand.
Page 51
TIDE and Tibbo BASIC User Manual Double-clicking the Name column in the watch pane will allow you to edit the name of the item you want to watch. The watch pane also allows you to change the value of any variable or object property (provided it is not a read-only property).
Page 52
This is one of the main reasons for the existence of enumeration types in Tibbo Basic. To remove a variable from the watch, select it and press Delete, select Debug >...
TIDE and Tibbo BASIC User Manual Scopes in Watch The watch facility is only active when the Virtual Machine is not running, i.e. the execution is stopped. Naturally, the TIDE cannot fetch variable values while the Virtual Machine is executing your program.
Programming Fundamentals This chapter attempts to provide a very quick run through the fundamentals of creating a program in Tibbo Basic. It was written under the assumption that the reader has some experience in programming for other languages. There is a marked resemblance between Tibbo Basic and other types of BASIC that you may already know.
Programming with TIDE platform. If your Tibbo Basic program runs on a refrigerator, you would probably have an event handler for the door opening. on_door_open light = 1 ' turn on the light when someone opens the door to your fridge.
Page 57
' is just like y=x+5 ' and even this is OK: So, spaces, tabs and linefeeds carry no special meaning in Tibbo Basic. Use them or lose them, as you like. The only exceptions are the If..Then... Else Statement and comments.
How to Use Colons Colons are actually not necessary in most parts of Tibbo Basic. They are a traditional part of many BASIC implementations, and are often used to group several statements in one line. However, since Tibbo Basic doesn't really care about spaces anyway, they lose their relevance.
' event names may contain more than one word after the object name. Introduction to Variables, Constants and Scopes Variables and constants are a major part of any programming language, and Tibbo Basic is no exception; below you will find explanations on the following: Variables And Their Types ...
Page 60
' x is now equal to y. str = "foobar" ' str now contains the string 'foobar' (with no quotes). Types of Variables Tibbo Basic supports the following variable types: Name Description byte Hardware-level. Unsigned. Takes 1 byte in memory. Can hold integer numerical values from 0 to 255 (&hFF).
TIDE and Tibbo BASIC User Manual string Hardware-level. Takes up to 257 bytes in memory (max string size can be defined separately for each string variable). Strings can actually be up to 255 bytes long but always begin with a 2-byte header -- 1 byte specifies current length, and 1 byte specifies maximum length.
Page 63
TIDE and Tibbo BASIC User Manual In the above example, both x and c will contain the same binary data. However, c is a signed 8-bit value, so binary contents of 254 mean -2. Strictly speaking, this reinterpretation will only happen if the value of x exceeds maximum positive number that c can hold -- 127.
Compile-time Calculations 4.2.4.4 Tibbo Basic always tries to pre-calculate everything that can be pre-calculated during compilation. For example, if you write the following code: as byte x=5+10+y...
Each element has a value and an index number, and may be accessed using this number. An example of a simple array would be: Index: Value: The code to produce such an array in Tibbo Basic would look like this: x(5) as char x(0) = x(1) =...
Page 67
TIDE and Tibbo BASIC User Manual variable. y = x(4) ' y would get a value of -30, according to the previous array y = x(z) ' y would get the value of index z within array x. As an example, you could iterate through an array with a loop (such as a For...
Page 69
' here, sum would be equal to the sum of the whole array. How much is that? Try and see. In Tibbo Basic, you may define up to 8 dimensions in an array. Alternative way of defining arrays We have already explained that the following string means "an array x containing 10 elements of type byte":...
TIDE and Tibbo BASIC User Manual Basic supports up to eight nesting levels (as in "array within a structure within a structure within and array" -- each structure or array is one level and up to 8 levels are possible). Here is a complex example:...
TIDE and Tibbo BASIC User Manual enum tiny tinyfoo, tinybar end enum ' this enum will be associated with a char type enum medium mediumfoo = mediumbar end enum ' this enum will be associated with a byte type enum...
Page 74
5. only this local x equals 30. next end sub Tibbo Basic supports several scopes: Global Scope Every compilation unit has, in itself, one global scope. Variables declared in this scope are accessible from within any sub or function in this compilation unit.
Page 75
HTML Scope This section applies only to platforms which include an HTTP server. This is a special scope, implemented in Tibbo Basic. HTML files included within a project may contain embedded Tibbo Basic code. This code is executed when the HTTP server processes an HTTP GET (or POST) request.
Page 77
BASIC language. The only way to do so was like this: s = "abc"+chr(10)+chr(13) 'add LF/CR in the end In Tibbo Basic you can achieve the same by using escape sequences -- C style: s = "abc\n\f" ''\n' means LF, '\f' -- CR const STR1 = "abc\x10\x13"...
"\x0A" -- leading zero must not be omitted. Introduction to Procedures A procedure is a named piece of code, which performs a designated task, and can be called (used) by other parts of the program. In Tibbo Basic, there are two types of procedures: Function Procedures...
Page 79
TIDE and Tibbo BASIC User Manual a(10) as byte ' a is a global variable -- outside the scope of the function. init_array as integer a(i) = ' the global variable gets changed. next end sub Subs change the value of the arguments passed to them using...
Page 81
Strict byref argument match is now required! Beginning with Tibbo Basic release 2.0, strict match is required between the type of byref argument and the type of variable being passed. For example, trying to...
TIDE and Tibbo BASIC User Manual As can be seen, this chain takes up 7 bytes of memory. However, this memory can be the same memory used for the on_event_1 chain, because these two chains will never execute at the same time. Thus, the total memory required for our project remains at 11 bytes.
Doevents 4.2.6.3 Although under Tibbo Basic, event-driven programming is the norm, there may be special cases in which you just have to linger an overly long time in one event handler. This will block execution of other events. They will just keep accumulating...
Page 85
TIDE and Tibbo BASIC User Manual 'calculate sum of all array elements -- this will surely take time! sum, f as word sum = 49999 sum = sum + arr(f) doevents 'don't want to stall other events so allow their execution...
Otherwise, we would once again get recursion (execution of an event handler while a previous instance of this event handler is already executing), which is not allowed under Tibbo Basic. Using Preprocessor Tibbo Basic compiler includes a preprocessor that understands several directives.
TIDE and Tibbo BASIC User Manual #define OPTION 0 'preprocessor directive Const COLOR=2 'constant used by your application OPTION=COLOR 'to a confused programmer, this looks like 0=2, but COLOR is not #defined, hence, it will be evaluated to 0 'hence, this code will be compiled in!
TCP communications). You can use this webserver as an engine for server-side scripting; simply put, you can output dynamic HTML content by including Tibbo Basic instructions within HTML pages.
Page 91
They would just have to enter an address in a web browser, and voila, up comes your interface. HTML support, as implemented in the Tibbo Basic, allows you complete control over page structure. You can use client-side technologies such as JavaScript, CSS etc., while still being able to dynamically generate HTML content within Tibbo...
To begin a block of Tibbo Basic code within an HTML file, you must use an escape sequence -- <? . To close the section of code, use the reverse escape sequence -- ?>...
This holds true even for string functions -- some platforms are so tiny, they do not even need to support string processing! Because of this, the 'core' of the Tibbo Basic language is actually very minimalistic -- we call it "pure" -- it contains only the statements listed under Statements below.
Platform Functions Many functions commonly available in other BASIC versions are implemented in Tibbo Basic on the platform level and not on the "pure" language level; these include also seemingly universal functions, such as string processing, or various date and time functions. This is done so because not every platform would actually need these functions, universal as they may seem.
You could say they are the programming-language equivalent of a sentence in human speech. Statements are built into Tibbo Basic itself, and are not platform-specific. Const Statement Function: Declares constants for use in place of literal values.
TIDE and Tibbo BASIC User Manual Example declare function hittest(x integer, y integer) as boolean declare sub dosomething (s as byref string) declare devicestate as integer Dim Statement Function: Defines a variable and allocates memory for it. [ public ] dim name1 [ (bounds1) ] [ , name2 [...
Page 99
TIDE and Tibbo BASIC User Manual do [ while | until ] expression Syntax: statement1 statement2 … [exit do] statementN loop statement1 statement2 … [exit do] statementN loop [ while | until ] expression Scope: Local and HTML See Also: For...
Description name Required. The name of the enum type. The name must be a valid Tibbo Basic identifier, and is specified as the type when declaring variables or parameters of the enum type. const[1, 2...] Required. The name for the constant in the enum.
TIDE and Tibbo BASIC User Manual Exit Statement Function: Immediately terminates execution of function or a loop. exit do Syntax: exit for exit function exit sub exit while Scope: Local and HTML See Also: Do-Loop Statement For... Next Statement Function...
TIDE and Tibbo BASIC User Manual a(10) as integer as byte f = 0 ' in a 10-member array, element indices are 0 to 9 sum = sum + a(f) next Function Statement Used to define functions -- distinct units in code which Function: perform specific tasks and always return a value.
TIDE and Tibbo BASIC User Manual arr1(5),arr2(5),f as byte on_sys_init arr1(0) = arr1(1) = arr1(2) = arr1(3) = arr1(4) = arr2(0) = arr2(1) = arr2(2) = arr2(3) = arr2(4) = 'compare arrays and jump if not exactly the same arr1(f)<>arr2(f)
This is the only construct under Tibbo Basic where line end matters. So, if you want to have several statements in such a construct, you need to place them all in the same line, and separate them with colons.
TIDE and Tibbo BASIC User Manual "filename" Contains the filename to be included. The path can be a relative path to the project path , an absolute path (such as c:\myfolder\myfile.tbs) or even a UNC path (such as \\MY-SERVER\Main\myfile.tbs). Details Makes compiler include the contents of a file at the point of the include statement.
TIDE and Tibbo BASIC User Manual case 'this expression has no code associated with it case 'code 'x=5' belongs to this expression Correct way to have a single block of code for two expressions is as follows: case 1,2 :...
TIDE and Tibbo BASIC User Manual type_name Required. Specifies the name for this structure type (not a particular variable). name[1, 2...] Required. Specifies the name for the member variable. bounds[1, 2...] Optional. Specifies the boundary (finite size) of a dimension in an array.
TIDE and Tibbo BASIC User Manual Boolean A data type. Please see Variables And Their Types ByRef A keyword designating a way of passing arguments. Appears as part of the following statements: Function Statement Sub Statement For further details, see...
TIDE and Tibbo BASIC User Manual Type Appears as part of the following statement: Type Statement Appears as part of the following statement: For... Next Statement True A byte constant with a value of 1, associated with boolean variables. Word A data type.
&b11101100 Error Messages Below is a listing of all error messages which may appear when trying to build and upload your Tibbo BASIC program onto a target. C1001 Description: This error occurs when a source file contains an “illegal” character (like a special character, a non-English letter, etc) outside of a string literal or a comment.
TIDE and Tibbo BASIC User Manual C1006 Description: This error occurs when Tibbo BASIC syntax is violated. Refer to the documentation of a particular statement to see its syntax. Example: select x ‘ error C1006: 'Case' expected case case true...
TIDE and Tibbo BASIC User Manual Identifier C1011 Description: This error occurs when attempting to define a procedure twice. Example: end sub ' error C1011: 'x' already has body end sub See Also Sub Statement Function Statement ...
TIDE and Tibbo BASIC User Manual See Also For... Next Statement C1016 Description: The exit statement may be used only from within certain statements (for, while, do-loop, sub, function). This error occurs when the compiler encounters an exit statement which is used not from within one of these statements.
TIDE and Tibbo BASIC User Manual the program tries to access this property in a different way. Example: sys.runmode = PL_SYS_MODE_DEBUG ' error C1021: write access to property is denied See Also Understanding Platforms C1022 Description: There are several system calls which the compiler uses directly, and are invoked implicitly in code (string comparison, string copy, conversion from string to number, etc).
TIDE and Tibbo BASIC User Manual L1003 Description: During linking, one or more addresses remained unresolved. That means that these addresses are referenced from one or more compilation units but are never defined. See Also Declare Statement L1004 Description:...
TIDE and Tibbo BASIC User Manual Objects, Properties, Methods, Events Under Tibbo Basic, these are all platform-specific constructs. Please refer to your Platform documentation for details about the objects, properties, methods and events for your platform. Development Environment Below is an overview of the TIDE GUI.
TIDE and Tibbo BASIC User Manual your workspace so it would serve you best both while editing code and while debugging. Another key difference is that while in Debug Mode you cannot enter any new code. Whenever you try to type code while in this mode, you will be prompted to stop program execution on the target and switch back to Edit Mode.
TIDE and Tibbo BASIC User Manual View Menu 6.2.3.3 Project Toolbar: Toggles (shows/hides) the Project toolbar. Debug Toolbar: Toggles the Debug toolbar. Status Bar: Toggles the Status Bar Project: Toggles the Project pane. Output: Toggles the Output pane. Clear Output: Clears the contents of the Output pane.
TIDE and Tibbo BASIC User Manual Image Menu 6.2.3.6 This menu is visible only when a graphical resource is selected for editing. TIDE "knows" how to work with .bmp, .jpg, .gif, and .png files. Resize: Changes the size of the image's "canvas". This is not re-sampling of the image: existing image elements won't shrink or get larger, just the total image size in pixels will change.
TIDE and Tibbo BASIC User Manual Cut: Self-explanatory. Paste: Self-explanatory. Undo: Cancels last action. Redo: Cancels last undo. Find: Self-explanatory. Find Next: Self-explanatory. Find Prev: Self-explanatory. Replace: Self-explanatory. Debug Toolbar 6.2.4.2 Select/Manage Target: Shows the platform-specific dialog used to select a target for your project and upload firmware.
TIDE and Tibbo BASIC User Manual Ellipse Tool Properties Toolbar Zoom Tool Properties Toolbar Selection Tool Properties Transparency Mode: For drag/drop and copy/paste operations selects whether pixels of background color will be copied to the destination as well. When the transparency mode is OFF the rectangular image fragment being copied or moved will overlay original image underneath completely.
TIDE and Tibbo BASIC User Manual Inversion Mode: Toggles rectangle tool's inversion mode on/off. When inversion is OFF, the rectangle's border will always be drawn in the fore-ground color and filling (for filled rectangles) will always be done with background color. When...
TIDE and Tibbo BASIC User Manual The Call Stack pane is covered under The Call Stack above. Output 6.2.7.2 Displays status messages while compiling, linking, uploading and debugging. Double clicking on an error message would move the cursor to the line of code which caused the error.
TIDE and Tibbo BASIC User Manual Language Element Icons Throughout TIDE, many icons are used for various Tibbo Basic constructs. Below is a complete listing: Constants (see Constants Enumeration Types (see User-Defined Types System Calls (see Function Reference Objects (see...
This is the practice of using one device to observe and control the state of a program running on another device, in order to find bugs in it. Under Tibbo Basic, your computer displays various status messages and information about variables...
TIDE and Tibbo BASIC User Manual Target The hardware device with which you are working. This is the device connected to the computer while debugging. The code you are writing actually runs on this device, and the debug messages originate from the device -- not from anywhere within your computer.
Page 153
TIDE and Tibbo BASIC User Manual and, hence, cannot be described in the object reference itself. Each platform section in this manual has its own "Platform-dependent Programming Information" topic. If you are reading documentation top-to-bottom (we have never actually met anyone who does) you can skip this section now.
The difference between the EM1000 and EM1000W platforms is that the EM1000W additionally includes the (Wi-Fi) object, which works with an external GA1000 add-on module to function. All other features of these two platforms are exactly the same. Both platforms will be collectively referred to as "EM1000(W)". Memory Space ...
TIDE and Tibbo BASIC User Manual Enum pl_int_num - a list of constants that define available interrupt lines. Enum pl_sock_interfaces - a list of available network interfaces. Enum pl_redir Enum pl_redir contains the list of constants that define buffer redirection (shorting) for this platform.
Page 159
TIDE and Tibbo BASIC User Manual the RX/W0&1in/din input of the serial port 3. 15- PL_IO_NUM_15_TX3 General-purpose I/O line 15 (P1.7). This line is also the TX/W1out/dout output of the serial port 3. 16- PL_IO_NUM_16_INT0: General-purpose I/O line 16 (P2.0).
TIDE and Tibbo BASIC User Manual PL_INT_NUM_2: Interrupt line 2 (mapped onto I/O line 18). PL_INT_NUM_3: Interrupt line 3 (mapped onto I/O line 19). PL_INT_NUM_4: Interrupt line 4 (mapped onto I/O line 20). PL_INT_NUM_5: Interrupt line 5 (mapped onto I/O line 21).
Page 163
TIDE and Tibbo BASIC User Manual Will auto- Will auto- Requires Requires PL_SER_MODE_UAR configure as configure configurati configuratio output as input on as n as input output Requires Requires PL_SER_MODE_WIE configuratio configuratio GAND n as output n as input PL_SER_MODE_CLO...
The difference between the EM1202 and EM1202W platforms is that the EM1202W additionally includes the (Wi-Fi) object, which works with an external GA1000 add-on module to function. All other features of these two platforms are exactly the same. Both platforms will be collectively referred to as "EM1202(W)". Memory Space ...
— handles Wi-Fi interface (only available on the EM1202W platform, requires GA1000 add-on module); — in charge of serial ports (UART, Wiegand, and clock/data modes); — handles I/O lines, ports, and interrupts; — controls graphical display panels (several types supported);...
Page 167
TIDE and Tibbo BASIC User Manual buffer of the serial port 2. 4- PL_REDIR_SER: Redirects RX data of the serial port or socket to the TX buffer of the serial port 3. 6- PL_REDIR_SOCK0: Redirects RX data of the serial port or socket to the TX buffer of socket 0.
TIDE and Tibbo BASIC User Manual PL_IO_NUM_22_INT6: Selects general-purpose I/O line 22 (P2.6). PL_IO_NUM_23_INT7: Selects general-purpose I/O line 23 (P2.7). PL_IO_NUM_24: Selects general-purpose I/O line 24 (does not belong to any 8-bit port). PL_IO_NUM_25: Selects general-purpose I/O line 25 (does not belong to any 8-bit port).
Page 171
TIDE and Tibbo BASIC User Manual You have to explicitly configure I/O lines as inputs or outputs On the EM1202(W) you need to explicitly enable or disable the output driver of each I/O line (controlled by the object). The io.enabled property allows you to do this.
Page 173
TIDE and Tibbo BASIC User Manual returned by the sys.currpll property. Data in the special configuration section of the EEPROM Bottom 8 bytes of the EEPROM (accessible through the stor object) are reserved for storing MAC address of the device. On power-up, the MAC address is read out from the EEPROM and programmed into the Ethernet controller.
The difference between the EM1206 and EM1206W platforms is that the EM1206W additionally includes the (Wi-Fi) object, which works with an external GA1000 add-on module to function. All other features of these two platforms are exactly the same. Both platforms will be collectively referred to as "EM1206(W)". Memory Space ...
TIDE and Tibbo BASIC User Manual Supported Objects 8.1.4.2 The following objects are found on the EM1206(W): Sock — socket communications (up to 16 UDP, TCP, and HTTP sessions); — controls Ethernet port; — handles Wi-Fi interface (only available on the...
Page 177
TIDE and Tibbo BASIC User Manual operation -- see below for details. Enum pl_io_num includes the following constants: 0- PL_IO_NUM_0_RX0_INT0 General-purpose I/O line 0 (P0.0). This line is also the RX/W1in/din input of the serial port 0 and the interrupt line 0.
Page 181
TIDE and Tibbo BASIC User Manual On the EM1206(W) there is a PLL that, when switched on, increases the main clock of the device 8-fold (power cosumption also increases roughly by as much). When the PLL is off, the clock frequency of the device is 11.0592MHz; when the PLL is on the clock frequency is 88.4736MHz.
TIDE and Tibbo BASIC User Manual Platform-dependent Constants Platform-dependent Programming Information Memory Space 8.1.5.1 The platform has the following amounts of program (FLASH) and variable (RAM) memory available: Program memory: 983040 Bytes Variable memory: 20,480 bytes EEPROM memory:...
TIDE and Tibbo BASIC User Manual Enum pl_io_num Enum pl_io_num contains the list of constants that refer to I/O lines available on this platform. Use these constants when selecting the line with the object (see the io.num property). All I/O lines of the DS1202 platform require explicit configuration as inputs or outputs -- this is done through the io.enabled...
TIDE and Tibbo BASIC User Manual Platform-dependent Programming Information 8.1.5.4 This section contains miscellaneous information pertaining to the DS1202 platform. Various objects described in the Object Reference direct you to this topic in all cases when object capabilities or behavior depends on the platform and, hence, cannot be described in the object reference itself.
Page 189
TIDE and Tibbo BASIC User Manual After the external reset (see sys.resettype ) the DS1202 boots with the PLL on or off depending on the state of the PE pin. For the serial port, there is a way to set the baudrate in the clock-independent (and, actually, platform-independent) way -- see ser.div9600...
TIDE and Tibbo BASIC User Manual Memory Space 8.1.6.1 The platform has the following amounts of program (FLASH) and variable (RAM) memory available: Program memory: 458,752 Bytes for the DS1206-512K; 983040 Bytes for the DS1206-1024K Variable memory: 20,480 bytes EEPROM memory:...
TIDE and Tibbo BASIC User Manual Enum pl_io_num Enum pl_io_num contains the list of constants that refer to I/O lines available on this platform. Use these constants when selecting the line with the object (see the io.num property). All I/O lines of the DS1206 platform require explicit configuration as inputs or outputs -- this is done through the io.enabled...
TIDE and Tibbo BASIC User Manual Enum pl_sock_interfaces Enum pl_sock_interfaces contains the list of network interfaces supported by the platform: 0- PL_SOCK_INTERFACE_NULL: Null (empty) interface. 1- PL_SOCK_INTERFACE_NET (default): Ethernet interface. Platform-dependent Programming Information 8.1.6.4 This section contains miscellaneous information pertaining to the DS1206 platform.
Page 197
TIDE and Tibbo BASIC User Manual The clock frequency affects all aspects of device operation that rely on this clock. Naturally, program execution speed depends on the clock frequency. Additionally, the baudrates of the serial port (defined by the ser.baudrate property) depend on the main clock.
TIDE and Tibbo BASIC User Manual Supported Variable Types (T1000-based Devices) 8.1.7.1 The following variable types are supported by T1000-based devices: Byte Word Dword Char Short (integer) Long Real (float) Boolean User-defined structures ...
When the device is in the serial upgrade mode, these LEDs indicate the status of firmware upload process. When the device is under TiOS firmware control and Tibbo BASIC application is not running, these LEDs show current Tibbo BASIC application status.
TIDE and Tibbo BASIC User Manual Fast-blinking BBBB... Tibbo BASIC application loaded but pattern (B= red and cannot run due to insufficient variable green together) (RAM) memory Fast-blinking G-G-G-... Tibbo BASIC application loaded but not pattern running. Fast-blinking R-R-R-... Tibbo BASIC application not loaded or pattern corrupted.
Comment: Additional information. For a device running fixed firmware, this is the owner name and the device name (does not apply to the EM1000). For a device running TiOS, this is the name of the Tibbo BASIC project currently loaded in memory.
Page 204
("lasso"), or by holding SHIFT while pressing the arrow keys to move down or up the list. This allows you to perform certain operations en masse -- such as uploading TiOS to an entire group of devices, or deploying a Tibbo BASIC program on multiple devices, etc. Stand-Alone Mode This dialog was designed so it could be accessed also without running TIDE, or indeed, without TIDE even being installed on the system.
TIDE and Tibbo BASIC User Manual targets on his network. To access the dialog in stand-alone mode, run em202upgr.vbs. If You Cannot See Your Target There can be several possible causes why you cannot see your target. Two of the most common ones are: 1) The target is not connected to the same subnet as the computer.
TIDE and Tibbo BASIC User Manual real invalid_valid r1=10E30 v=cfloat(r1) 'v will return 0- VALID r1=r1*10E20 'at this point you will get FPERR exception if you are in the debug mode v=cfloat(r1) 'v will return 1- INVALID Chr Function Function: Returns the string that consists of a single character with ASCII code asciicode.
TIDE and Tibbo BASIC User Manual Returns: A dot-separated string consisting of decimal representations of all binary values in the input string. Each decimal value will be in the 0-255 range. ddval See Also: Part Description String of binary values to be converted into a dot-decimal string.
TIDE and Tibbo BASIC User Manual as real as string 'demonstrate output formats r1=10000000000.0 'notice '.0' -- it is necessary or compilier will generate an error s=ftostr(r1,FTOSTR_MODE_ME,11) 'result will be '1E+010' s=ftostr(r1,FTOSTR_MODE_PLAIN,11) 'result will be '10000000000' s=ftostr(r1,FTOSTR_MODE_AUTO,11) 'result will be '1E+010' because this...
TIDE and Tibbo BASIC User Manual Instr Function Function: Finds the Nth occurrence (defined by num, counting from 1) of a substring substr in a string sourcestr. Search is conducted from position frompos (leftmost character has position 1). Syntax: instr(frompos as byte,byref sourcestr as string, byref...
TIDE and Tibbo BASIC User Manual Lhex Function Function: Converts unsigned 32-bit numeric value (dword) into its HEX string representation. Syntax: lhex(byref num as dword) as string lstr stri lstri lbin See Also: lval Part Description Value to convert. Details Standard "&h"...
TIDE and Tibbo BASIC User Manual Part Description sourcestr String to convert. Details Recognizes &b (binary) and &h (hexadecimal) prefixes. Can be invoked implicitly, through the dword_var= string_var expression (see example below). Compiler is smart enough to pre-calculate constant-only expressions involving implicit use of lval function.
TIDE and Tibbo BASIC User Manual Details Examples s = mid("ABCDE",2,3) ' result will be 'BCD'. Mincount Function Function: Returns the minutes number for a given hours and minutes. Syntax: mincount(hours as byte, minutes as byte) as word Minute number elapsed since midnight (00:00). This Returns: value is in the 0-1439 range.
TIDE and Tibbo BASIC User Manual Examples pl_months m = month(32) ' result will be PL_MONTH_FEBRUARY - day number 32 was in February 2000. Random Function Function: Generates a string consisting of len random characters. Syntax: random(len as byte) as string...
TIDE and Tibbo BASIC User Manual s, hash As String 'simple calculation on a short string s="Sting to calculate SHA1 on" hash=sha1(s,"",SHA1_FINISH,Len(s)) 'calculation on the entire contents of data in the 'text.txt 'file romfile.open("text.txt") hash="" s=romfile.getdata(192) 'use max portions While...
TIDE and Tibbo BASIC User Manual Strsum Function Function: Calculates 16-bit (word) sum of ASCII codes of all characters in a string. Syntax: strsum(byref sourcestr as string) as word See Also: Part Description sourcestr String to work on Details This function is useful for checksum calculation.
TIDE and Tibbo BASIC User Manual Weekday Function Function: Returns the day of the week for a given day number. Syntax: weekday(daycount as word) as pl_days_of_week One of pl_days_of_week constants: Returns: 1- PL_DOW_MONDAY: Monday. 2- PL_DOW_TUESDAY: Tuesday. 3- PL_DOW_WEDNESDAY: Wednesday.
TIDE and Tibbo BASIC User Manual on_sys_init net.ip="192.168.1.95" sock.num=0 sock.targetip= "192.168.1.96" '...and everything else that you may need! end sub Buffer Management How to allocate buffer memory Some objects, such as the sock , rely on buffers for storing the data being sent and received.
PLL is a module of the device that transforms the clock generated by onboard crystal into higher frequency (x8 of the base for Tibbo devices). When the PLL is on, the device runs at 8 times the base frequency, when the PLL is off, the device runs at a "native"...
Serial Number Tibbo devices currently in production use newer flash memory ICs featuring security register. This is a 128-byte register that has two 64-byte fields. The first field is one-time programmable, and the second field is pre-programmed at the factory and contains a unique serial number.
TIDE and Tibbo BASIC User Manual Miscellaneous sys.version property returns the version of the TiOS (firmware) running on your device. sys.halt method can be used to halt the execution of your program. For example, you can use this to halt the program when the Ethernet interface failure is detected: net.failure= YES...
PLL to default state (typically ON). On some devices there is a hardware jumper that defines the post-external reset state of the PLL. Not all Tibbo devices have PLL- check "Platform-dependent Programming Information" topic inside your platform specifications section to find out if there is a PLL on your platform.
PLL to default state (typically ON). On some devices there is a hardware jumper that defines the post-external reset state of the PLL. Not all Tibbo devices have PLL- check "Platform-dependent Programming Information" topic inside your platform specifications section to find out if there is a PLL on your platform.
TIDE and Tibbo BASIC User Manual .Reboot Method Function: Causes your device to reboot. sys.reboot Syntax: Returns: sys.currentpll sys.runmode sys.resettype , and See Also: sys.halt Details After the device reboots it will behave as after any other reboot: enter PAUSE...
The serial number is stored in the security register of the flash IC. Older generation of flash ICs used in Tibbo devices did not have the security register. This method will return 1- NG if you attempt to set the serial number of the device that does not have the security register.
TIDE and Tibbo BASIC User Manual Details Internal resets are generated when the device self-reboots. This can be caused by the execution of sys.reboot in your application, or command from TIDE. External resets are the ones that are caused by power-cycling (turning the device off and back on) or applying a reset pulse to the RTS line of the device (pushing reset button).
Buffer shorting feature for fast data exchange between the ser object and other objects (such as the sock object) that support standard Tibbo Basic data buffers. For the UART mode: Ability to set any baudrate (that is physically possible on a particular platform) by specifying "divider value"...
The buffers available are: The TX buffer, which contains data due to be sent out of the port (i.e, it's the transmit of your device!). Your Tibbo Basic application puts the data into the TX buffer. The RX buffer, which contains incoming data received by the port. This data is to be processed by your application.
Page 243
The serial port will stop sending the data once the line goes high. Note, that some Tibbo devices have a hardware buffer called "FIFO" ("fist-in-first-out" if you really need to know ;-). Once the TX data is in the FIFO it will be sent out even if the CTS line goes low.
TIDE and Tibbo BASIC User Manual The CTS line is not controlled by the serial port when in the half-duplex mode. Your application can manipulate this line through the object. Wiegand Mode In the Wiegand mode the serial port is able to receive the data directly from any Wiegand device, such as card reader and also output the data in the Wiegand format, as if it was a card reader itself.
Page 247
TIDE and Tibbo BASIC User Manual used too (figure B). In case you are building a product that will also accept clock/ data input, you may need to control whether the W0&1in input should receive a logical AND of two lines, or just one of the lines. Schematic diagram C uses an additional I/O line of the device to control this.
Page 249
TIDE and Tibbo BASIC User Manual The serial port outputs clock/data signals through cout and dout lines and receives the data via cin and din lines. Your application should not attempt to work with cout and dout outputs directly through the object when the serial port is in the clock/data mode.
Page 251
TIDE and Tibbo BASIC User Manual Can you tell what serial port the statement above applies to? Neither can the platform. Thus, the correct syntax would be: ser.num = ser.mode = PL_SER_MODE_WIEGAND Now the platform knows what port you're working with. Once you have set the port selector (using ser.num), every method and property after that point is taken to...
Page 253
TIDE and Tibbo BASIC User Manual select required mapping. If your device does not support remapping then its platform will not have these properties. You can only perform remapping when the serial port is closed. UART, Wiegand, or clock/data mode selection ser.mode...
Page 254
Escape sequences are rather arbitrary. They follow the style of escape sequences that Tibbo introduced before. However, they are useful for certain things. For example , if your application has a normal mode and serial 'setup' mode, you can use this sequence to switch into setup mode.
TIDE and Tibbo BASIC User Manual serial programming mode or perform some other similar task. Sending and Receiving Data (TX and RX buffers) The serial port sends and receives data through TX (transmit) and RX (receive) buffers. Read on and you will know how to allocate memory for buffers, use them, handle overruns, and perform other tasks related to sending and receiving of data.
TIDE and Tibbo BASIC User Manual You can also find out how much committed data the RX buffer currently contains with the ser.rxlen property (see Serial Settings for explanation of what committed data is). Sometimes you need to clear the RX buffer without actually extracting the data. In such cases the ser.rxclear...
TIDE and Tibbo BASIC User Manual Actually, this call will handle no more than 255 bytes in one pass. Even though we seemingly copy the data directly from the RX buffer to the TX buffer, this is done via a temporary string variable automatically created for this purpose.
TIDE and Tibbo BASIC User Manual Redirecting Buffers The following example appeared under Receiving Data on_ser_data_arrival ser.setdata(ser.getdata(ser.txfree)) ser.send end sub This example shows how to send all data incoming to the RX buffer out from the TX buffer, in just two lines of code. However fast, this technique still passes all data through your BASIC code, even though you are not processing (altering, sampling) it in any way.
TIDE and Tibbo BASIC User Manual Technically speaking, this property should be called divisor, not baudrate. We called it baudrate so that you could easily find it. .Bits Property Function: Specifies the number of data bits in a word TXed/RXed by...
TIDE and Tibbo BASIC User Manual 9600bps may be different at different times. For example, some devices have PLLs (see sys.currentpll ). Enabling and disabling PLL changes the clock frequency of the device and this affects the value returned by ser.div9600.
TIDE and Tibbo BASIC User Manual Type 2 Type 2 escape sequence is not based on any timing. Escape sequence consists of escape character (defined by the ser.escchar property) followed by any character other than escape character. To receive a data character whose ASCII code matches that of escape character the serial port must get this character twice.
TIDE and Tibbo BASIC User Manual .Interface Property Chooses full-duplex or half-duplex operating mode for Function: currently selected serial port (selection is made through ser.num Enum (pl_ser_interface, byte) Type: 0- PL_SER_SI_FULLDUPLEX (default): full-duplex mode. Value Range: 1- PL_SER_SI_HALFDUPLEX: half-duplex mode.
TIDE and Tibbo BASIC User Manual .Notifysent Method Using this method for the selected serial port (selection is Function: made through ser.num ) will cause the on_ser_data_sent event to be generated when the amount of committed data in the TX buffer is found to be below "threshold"...
TIDE and Tibbo BASIC User Manual Details This event may be generated only after the ser.notifysent method was used. Your application needs to use the ser.notifysent method EACH TIME it wants to cause the on_ser_data_sent event generation for a particular port. When the event handler for this event is entered the ser.num...
TIDE and Tibbo BASIC User Manual include all possible redirections for this platform. Specifying redir value of 0- PL_REDIR_NONE cancels redirection. When the redirection is enabled for a particular serial port, the on_ser_data_arrival event is not generated for this port.
TIDE and Tibbo BASIC User Manual because 16 bytes are needed for internal buffer variables. The serial port cannot RX data when the RX buffer has zero capacity. .Rxclear Method Function: For the selected serial port (selection is made through ser.
TIDE and Tibbo BASIC User Manual .Sinkdata Property For the currently selected serial port (selection is made Function: through ser.num ) specifies whether the incoming data should be discarded. Enum (yes_no, byte) Type: 0- NO (default): normal data processing. Value Range: 1- YES: discard incoming data.
TIDE and Tibbo BASIC User Manual Details Notice, that the amount of free space returned by this property does not take into account any uncommitted data that might reside in the buffer (this can be checked ser.newtxlen ). Therefore, actual free space in the buffer is ser.txfree-ser.
TIDE and Tibbo BASIC User Manual Checking Ethernet Status net.failure read-only property tells you if the NIC is functioning properly. net.linkstate read-only property tells you if there is a live Ethernet cable plugged into the Ethernet port of your device, and, if yes, whether this is a 10BaseT or 100BaseT connection.
TIDE and Tibbo BASIC User Manual Details This property can only be written to when no socket is engaged in communications through the Ethernet interface, i.e. there is no socket for which sock.statesimple <> 0- PL_SSTS_CLOSED and sock.currentinterface = 1- PL_INTERFACE_ETHERNET.
(firmware) file into the device through the serial port. The button is not doing anything system-related at other times, so it can be used by your Tibbo BASIC application -- hence, the button object. The object offers the folloing: button.pressed property returns current (immediate) state of the button.
TIDE and Tibbo BASIC User Manual on_button_released 'see how much time has elapsed button.time>4 then 'the button for pressed for a "long" time -- do one thing else 'the button was pressed for a "short" time -- do another thing...
Adjustable receive (RX), transmit (TX), and other buffer sizes for optimal RAM utilization. Buffer shorting feature for fast data exchange between the sock object and other objects (such as the object) that support standard Tibbo Basic data buffers. Overview 8.3.5.1 This section covers the socket object in detail.
TIDE and Tibbo BASIC User Manual sock.num = sock.protocol = sock.connectiontimeout = sock.httpmode = ' etc The events for this object are not separate for each socket. An event such as on_sock_data_arrival serves all sockets on your platform. Thus, when an event...
TIDE and Tibbo BASIC User Manual the packet and the sender won't know whether the packet was received or not. Each UDP datagram lives its own life and you are responsible for dividing your data into chunks of reasonable size and sending it in separate datagrams. There is no connection establishment or termination on UDP- the datagram can be sent instantly, without any preparation.
TIDE and Tibbo BASIC User Manual HTTP is only possible on TCP! Setting allowed interfaces The sock object is interface-independent and supports communications over more than one interface. The sock.allowedinterfaces property defines the list of interfaces on which the current socket will accept incoming connections. The list is different and depends on the platform.
TIDE and Tibbo BASIC User Manual a reconnect from any host or port. Basically, this means, that whatever connection is in progress, it will be interrupted and replaced by any other incoming connection. Do not use reconnects for HTTP sockets! Reconnects and HTTP do not play nicely together.
Page 301
TIDE and Tibbo BASIC User Manual Incoming datagram Socket reaction 192.168.100.40:1000 sends UDP Datagram accepted, UDP "connection" datagram to the port 3000 of our is now in progress, the socket will be device sending all further outgoing datagrams to 192.168.100.40:1000.
TIDE and Tibbo BASIC User Manual Incoming TCP connection to port 1001 Connection will be accepted on socket from host 192.168.100.40:29600 0 since this socket lists 1001 as one of the listening ports and this incoming connection request is from "correct"...
Page 305
TIDE and Tibbo BASIC User Manual There is one difference to grasp regarding the socket that is sending its outgoing packets as broadcasts: no incoming UDP packet that would have normally be interpreted as a re-connect will cause the socket to "switchover" to the source IP- address of the packet.
In both cases the socket will handle connection closing automatically, without any help from your Tibbo BASIC program or the VM. In fact, the socket will accept connection termination even when the VM is stopped (for example, it was paused on your breakpoint).
Page 307
TIDE and Tibbo BASIC User Manual Just like with connection establishment, you can monitor the progress of connection termination- see Checking Connection Status Notice, that depending on the socket state at the moment of sock.close method invocation, the socket may need to resort to a simple connection closing option- reset or discard.
Page 309
-- "newstatesimple". These arguments contains the state of the socket at the moment when the on_sock_event was generated. Newstate and newstatesimple arguments have been introduced in Tibbo Basic V2.0. Before, their role was played by two read-only properties -- sock.event...
Page 311
TIDE and Tibbo BASIC User Manual 'Correct code -- on startup we order the connection to be established and in the on_sock_event event handler we record the MAC address of the 'other side' On_sys_init sock.targetip="192.168.100.40" 'we prepare for the connection sock.targetport=2000...
TIDE and Tibbo BASIC User Manual 'Even better code! sock.close While sock.statesimple<>PL_SSTS_CLOSED 'here we wait for the connection to be closed doevents 'Not necessary but useful -- lets other events execute Wend doevents ' Absolutely essential for this particular case! sock.connect...
TIDE and Tibbo BASIC User Manual Receiving data is a one-step process. To extract the data from the RX buffer, use sock.getdata method. Data may only be extracted once from the buffer. Once extracted, it is no longer in the buffer. For example:...
TIDE and Tibbo BASIC User Manual been committed for sending. For UDP, this is basically the length of UDP datagram being created. The TX buffer also has a sock.txfree property, which directly tells you how much space is left in it. This does not take into account uncommitted data in the buffer -- actual free space is sock.txfree-sock.newtxlen!
TIDE and Tibbo BASIC User Manual Receiving Data in UDP Mode In the previous section we have already explained how to handle data reception when the socket is in the TCP mode. This section provides explanation for receiving data with UDP.
Page 321
TIDE and Tibbo BASIC User Manual as string "This is a long string waiting to be sent. Send me already!" on_button_pressed sock.notifysent(sock.txbuffsize-len(s)) ' causes the on_sock_data_sent event to fire when the TX buffer has space for our string end sub on_sock_data_sent sock.setdata(s)
TCP packets. For example, as it turns out, some data encryption methods work on a packet level. Erase the border between TCP packets -- and you can't decrypt the data. Introduced in Tibbo Basic V2.0, new sock.splittcppackets property and...
TIDE and Tibbo BASIC User Manual data into the TX buffer and execute sock.send , the socket won't send this data out unless entire contents of the TX buffer can be sent out in a single TCP packet. Here is an example of how you can use that: sock.splittcppackets=YES...
TIDE and Tibbo BASIC User Manual dissolved. To the receiving TCP socket or serial port, the data appears to be a stream. Sinking Data Sometimes it is desirable to ignore all incoming data while still maintaining the connection opened. The sock.sinkdata...
TIDE and Tibbo BASIC User Manual buffer. Allocation is requested through the sock.tx2buffrq method. Actual memory allocation is done through the sys.buffalloc method which applies to all buffers previously specified. Here is an example: b1, b2, b3, b4, b5 as byte 'setup for other objects, sockets, etc.
TIDE and Tibbo BASIC User Manual on_sock_inband as string 'we will keep the data from the CMD buffer here as string 'this will keep individual inband commands as byte s=sock.getinband 'we get entire CMD buffer contents into the s x=instr(1,s,chr(sock.endchar)) while x<>0...
HTML file in your project does not exceed 65534 bytes. 65534 is actually the size limitation for the compiled HTML file. When compiling your project, the TIDE will separate the static portion of the file from the Tibbo Basic code fragments. Only the compiled file size matters. HTTP-related Buffers For the HTTP to work, you need to allocate some memory to the following buffers: ...
TIDE and Tibbo BASIC User Manual Notice, that in most cases you will need to reserve more than one socket for HTTP. The HTTP server may need to service multiple requests from different computers at the same time. Even for a single computer and a single HTML page, more than one socket may be needed.
TIDE and Tibbo BASIC User Manual If there is an incoming HTTP connection request, and if your application has no HTTP sockets configured to accept this connection, then the system will still respond with a reset. This behavior allows your application to get away with fewer HTTP sockets. Here is why.
Page 337
TIDE and Tibbo BASIC User Manual device, so "polite" waiting shall include a doevents statement: <? string(4) ?> <!DOCTYPE HTML public "-//W3C//DTD W3 HTML//EN"> <HTML> <BODY> The state of line is:!<br> <? 'This is a BASIC code snippet. Get the state of the line.
. Actual HTML contents received by the browser may partially be generated by your Tibbo BASIC application. Files of other types -- plain text, graphics, etc. -- cannot include executable code and are static in nature. These files are sent to the browser "as is".
TIDE and Tibbo BASIC User Manual Working with HTTP Variables HTML pages often pass "variables" to each other. For example, if you have an HTML form to fill on page "form.html" you may want to have the data input by the user on page "result.html".
Page 341
TIDE and Tibbo BASIC User Manual Here is a modified login example: In the event handler for the on_sock_postdata event we extract available HTTP variable data and process it. The event will be called as many times as necessary. For example, we may save the data into a file: On_sock_postdata() fd.setdata(sock.gethttprqstring(255))
TIDE and Tibbo BASIC User Manual You will get everything shown in blue. Properties, Methods, and Events 8.3.5.2 This section provides an alphabetical list of all properties, methods, and events of the sock object. .Acceptbcast Property For the currently selected socket (selection is made...
TIDE and Tibbo BASIC User Manual sockets arbitrarily. .Cmdbuffrq Method For the selected socket (selection is made through sock. Function: ) pre-requests "numpages" number of buffer pages (1 page= 256 bytes) for the CMD buffer of the socket. sock.cmdbuffrq(numpages as byte) as byte...
TIDE and Tibbo BASIC User Manual .Currentinterface R/O Property For the currently selected socket (selection is made Function: through sock.num ) returns the network interface this socket is currently communicating through. Enum (pl_sock_interfaces, byte) Type: Platform-specific. See the list of pl_sock_interfaces Value Range: constants in the platform specifications.
TIDE and Tibbo BASIC User Manual .Getdata Method For the selected socket (selection is made through sock. Function: ) returns the string that contains the data extracted from the RX buffer. ser.getdata(maxinplen as word) as string Syntax: String containing data extracted from the RX buffer...
TIDE and Tibbo BASIC User Manual (UDP). If you do not set this property directly, it's value will be: 0- NO: for all outgoing connections (active opens) of the socket. 0- NO: for incoming connections received on one of the ports from the sock.
TIDE and Tibbo BASIC User Manual .Inbandcommands Property For the currently selected socket (selection is made Function: through sock.num ) specifies whether inband command passing is allowed. Enum (no_yes, byte) Type: 0- NO (default): inband commands are not allowed. Value Range: 1- YES: inband commands are allowed.
TIDE and Tibbo BASIC User Manual .Localportlist Property For the currently selected socket (selection is made Function: through sock.num ) sets/returns the list of listening ports on any of which this socket will accept an incoming UDP or TCP connection.
TIDE and Tibbo BASIC User Manual The value of this property won't exceed sock.numofsock Value Range: -1 (even if you attempt to set higher value). Default= 0 (socket #0 selected). See Also: Details Sockets are enumerated from 0. Most other properties and methods of this object relate to the socket selected through this property.
See sock.state sock.statesimple for detailed description of reported socket states. Newtate and Newstatesimple arguments of the on_sock_event have been introduced in the Tibbo Basic release 2.0. They replace sock.event sock. eventsimple R/O properties which are no longer available.
TIDE and Tibbo BASIC User Manual Length of the new data in the RXed TCP packet. Details This event is only generated when sock.splittcppackets = 1- YES and sock. inbandcommands = 0- DISABLED. Notice that only new data, never transmitted before, is counted.
TIDE and Tibbo BASIC User Manual Part Description redir Platform-specific. See the list of pl_redir constants in the platform specifications. Details Data redirection (sometimes referred to as "buffer shorting") allows to arrange efficient data exchange between ports, sockets, etc. in cases where no data alteration or parsing is necessary, while achieving maximum possible throughput is important.
TIDE and Tibbo BASIC User Manual sock.reset Syntax: Returns: sock.close See Also: Details For TCP connections that were established, being opened, or being closed this will be a reset (RST will be sent to the other end of the connection). If connection was in the ARP phase or the transport protocol was UDP (sock.protocol...
TIDE and Tibbo BASIC User Manual Part Description numpages Requested numbers of buffer pages to allocate. Details Returns actual number of pages that can be allocated. Actual allocation happens when the sys.buffalloc method is used. The socket is unable to RX data if its RX buffer has 0 capacity.
TIDE and Tibbo BASIC User Manual immediately after the on_sock_data_arrival event handler is exited. .Send Method For the selected socket (selection is made through sock. Function: ) commits (allows sending) the data that was previously saved into the TX buffer using the sock.setdata...
TIDE and Tibbo BASIC User Manual .Splittcppackets Property For the currently selected socket (selection is made Function: through sock.num ) specifies whether the program will have additional control over the size of TCP packets being received and transmitted. Enum (no_yes, byte)
Page 373
TIDE and Tibbo BASIC User Manual 0- PL_SST_CLOSED (default): Connection is closed (and Value Range: haven't been opened yet, it is a post-powerup state). Applied both to UDP and TCP. 1- PL_SST_CL_PCLOSED: Connection is closed (it was a passive close). Applies only to TCP.
TIDE and Tibbo BASIC User Manual .Targetbcast Property For the currently selected socket (selection is made Function: through sock.num ) specifies whether this port will be sending its outgoing UDP datagrams as link-level broadcasts. Enum (no_yes, byte) Type: 0- NO: UDP datagrams will be sent as "normal" packets...
TIDE and Tibbo BASIC User Manual See Also: Closing Connections Details This property is reset to 0 each time there is some data exchanged across the socket connection. The property increments at 0.5 second intervals while no data is moving through this socket.
TIDE and Tibbo BASIC User Manual .Txbuffsize R/O Property For the currently selected socket (selection is made Function: through sock.num ) returns current TX buffer capacity in bytes. Word Type: 0-65535, default= 0 (0 bytes). Value Range: See Also: Details Buffer capacity can be changed through the sock.txbuffrq...
TIDE and Tibbo BASIC User Manual This property allows programmatic generation of non-HTML files. In the above example it is possible to generate the BMP file through a BASIC code. There is no other way to do this, since only HTML files are parsed for BASIC code inclusions.
TIDE and Tibbo BASIC User Manual io.portnum=2 'select port #2 io.portenabled=&hFF 'this means that every port line's output buffer will be enabled (&hFF=&b11111111) 'output &h55: port lines 0, 2, 4, and 6 will be at HIGH, 4 remaining lines will be at LOW (&h55=&b01010101) io.portstate=&h55...
I/O lines it uses cannot (should not) be manipulated though the io object. Controlling Output Buffers As far as the I/O line/port control goes, there are two kinds of Tibbo devices and corresponding platforms -- those without output buffer control, and those with output buffer control.
TIDE and Tibbo BASIC User Manual uses may be configured for input or output automatically. For such lines, when the corresponding special function block is disabled, the state of the output buffer is restored automatically to what it used to be prior to enabling this function block.
TIDE and Tibbo BASIC User Manual .Intnum Property Sets/returns the number of currently selected interrupt Function: line. Enum (pl_int_num, byte) Type: Platform-specific. See the list of pl_int_num constants in Value Range: the platform specifications. See Also: Working With Interrupts Details Selected interrupt line can be enabled or disabled using the io.intenabled...
TIDE and Tibbo BASIC User Manual On_io_int Event Function: Generated when the change of state on one of the enabled interrupt lines is detected. Declaration: on_io_int(linestate as byte) See Also: Working With Interrupts Part Description linestate 0-255. Each bit of this value corresponds to one interrupt line in the order that these lines are declared in the pl_int_num enum.
TIDE and Tibbo BASIC User Manual No line pre-selection with the io.portnum property is required and the value of the io.portnum will not be changed. .Portstate property Sets/returns the state of the currently selected I/O port Function: (selection is made through the io.portnum...
TIDE and Tibbo BASIC User Manual as word as string romfile.open("settings.txt") romfile.size=0 then 'File does not exist! Do something about it! end if 'look for the 'port' substring w=romfile.find(1,"Port",1) then 'Line not found- do something about it! end if romfile.pointer=w...
TIDE and Tibbo BASIC User Manual .Open Method 8.3.7.4 Opens or re-opens a resource (ROM) file. Function: romfile.open(byref filename as string) Syntax: Returns: Romfile Object, romfile.size See Also: Part Description filename Name of the ROM file to open. Details Only one ROM file can be opened at any given time. If the file exists and is not empty the romfile.pointer...
TIDE and Tibbo BASIC User Manual your application equals the capacity of the IC minus the size of the special configuration area. By default, when you access the first byte of the EEPROM you are actually accessing the first memory location above the special configuration area. One property -- stor.base...
Programming Information" topic inside your platform specifications section). By setting the stor.base to 1 you are allowing access to the special configuration area. With Tibbo Basic release V2, this method had to be renamed from .get to .getdata. This is because the period (".") separating "stor" from "getdata"...
Programming Information" topic inside your platform specifications section). By setting the stor.base to 1 you are allowing access to the special configuration area. With Tibbo Basic release V2, this method had to be renamed from .set to .setdata. This is because the period (".") separating "stor" from "setdata"...
LEDs that are present on all external devices, boards, and some modules offered by Tibbo. All modules have SG and SR I/O lines that are meant for controlling external status LEDs. Note that when the Tibbo BASIC application is not...
For channel 0, reading the property always returns (-1), and writing has no effect. All other channels use regular I/O lines of Tibbo devices. Any I/O line can be selected to be the green control line of the selected channel. By default, all control lines are mapped to the non-existent line PL_IO_NULL.
For channel 0, reading the property always returns (-1), and writing has no effect. All other channels use regular I/O lines of Tibbo devices. Any I/O line can be selected to be the red control line of the selected channel. By default, all control lines are mapped to the non-existent line PL_IO_NULL.
TIDE and Tibbo BASIC User Manual Details This can only happen for "non-looped" patterns. Multiple on_beep events may be waiting in the event queue. .Play Method 8.3.10.3 Loads new beeper pattern to play. Function: pat.play(byref pattern as string, patint as...
It is not necessary to use rtc.set if the backup power was present while the device was off. With Tibbo Basic release V2, this method had to be renamed from .get to .getdata. This is because the period (".") separating "rtc" from "getdata"...
It is not necessary to use rtc.set if the backup power was present at all times while the device was off. With Tibbo Basic release V2, this method had to be renamed from .get to .getdata. This is because the period (".") separating "stor" from "setdata"...
Supported Controllers/Panels Understanging Controller Properties Display panels come in all types, shapes, and sizes. Tibbo supports a limited but growing number of controllers/panels . Each supported controller requires its own "mini-driver". Your application cannot specify the desired controller. Instead, controller type is selected through the Customize Platform dialog, accessible through the Project Settings dialog.
TIDE and Tibbo BASIC User Manual color_red, color_green, color_blue As word lcd_red=val("&b"+strgen(lcd.redbits/&hFF,"1")+strgen(lcd.redbits &hFF,"0")) lcd_green=val("&b"+strgen(lcd.greenbits/&hFF,"1")+strgen(lcd.greenbits &hFF,"0")) lcd_blue=val("&b"+strgen(lcd.bluebits/&hFF,"1")+strgen(lcd.bluebits &hFF,"0")) Now you can scientifically work out the constant for the white color: lcd_white=lcd_red+lcd_green+lcd_blue In reality, you don't have to bother calculating color_white like this.
TIDE and Tibbo BASIC User Manual lcd.line method draws a line between any points. Lcd.verline lcd. horline draw vertical and horizontal lines correspondingly. Use the last two methods whenever possible because they work faster than generic lcd.line. The line is drawn using the color set in the lcd.forecolor...
Page 414
"aligned". It will also work if you select a font which is "perpendicular" to your display, but text printing might slow down considerably. We typically offer two versions for each font, for example, "Tibbo-5x7(V).bin" and "Tibbo-5x7(H)". V stands for "vertical" and "H" stands "horizontal".
Page 415
TIDE and Tibbo BASIC User Manual text horizontally (remember, text height is equal to lcd.fontheight ). In the following example, we align the text output along the right side of the screen. This requires us to know how wide this output will be: x=lcd.getprintwidth("Text")
This topic details font file format used by the LCD object. The font file is a resource file that is added to your Tibbo Basic project. Like all other resource files "attached" to your project, font files are accessible through the romfile object.
Page 417
TIDE and Tibbo BASIC User Manual Contains various information such as the total number of characters in this font, character height, etc. Also contains Header the number of code groups in the code groups table (see below). Contains descriptors of "code groups". Each code group...
Page 419
TIDE and Tibbo BASIC User Manual byte encoding, the orientation field of the header defines whether pixels are combined horizontally or vertically. The drawings below illustrate how character bitmaps are stored in the font file. As an example, characters of 10x14 size (in pixels) are used. Drawing A is for one pixel/byte encoding, drawing B -- for 8 pixels/byte with vertical orientation, C -- for 8 pixels/byte with horizontal orientation.
TIDE and Tibbo BASIC User Manual romfile.open("icon_strip.bmp") lcd.bmp(romfile.offset,0,0,11,0,11,11) 'display the second icon (right arrow) Note that only 2-, 16-, and 256-color modes are currently supported and the lcd. bmp will return 1- NG if you try to display any other type of BMP file. Compressed BMP files will be rejected too.
Page 423
TIDE and Tibbo BASIC User Manual on. If you are using display locking, you should ideally place locks/unlocks in each related routine. A complication arises with regards to when to unlock the display. For example, supposing you have two subs: lcd_sub1 and lcd_sub2: 'some main routine that invokes lcd_sub1 and lcd_sub2 ..
Himax HX8309 (Ampire AM176220) None of the above suits your project's needs? Tibbo can be contracted to develop a driver for another display you want to use. We offer reasonable development prices and ZNR (zero non-refundable) payment scheme, in which your initial payment for the driver development is gradually returned to you as you purchase Tibbo hardware.
Page 425
TIDE and Tibbo BASIC User Manual I/O line numbers are from the pl_io_num enum. Port number is from the pl_io_port_num enum. Line and port numbers are platform-specific. See the list of pl_io_num and pl_io_port_num constants in the platform specifications. For the TEV-LB0 board, the lcd.iomapping property should be set to "44,46,40,41,43,42,4".
TIDE and Tibbo BASIC User Manual For the TEV-LB0 board, lcd.iomapping should be set to "44,43,42,41,40,4". Code example -- TEV-LB1 This code will properly setup and enable this controller/panel (we assume that the testing is done using the TEV-LB1 board): lcd.iomapping="44,43,42,41,40,4"...
TIDE and Tibbo BASIC User Manual on this property. .Bluebits R/O Property A 16-bit value packing two 8-bit parameters: number of Function: "blue" bits per pixel (high byte) and the position of the least significant blue bit within the color word (low byte).
TIDE and Tibbo BASIC User Manual enabled. This will only work if your display is properly connected, correct display type is selected in your project, lcd.iomapping is set property, and necessary I/O lines are configured as outputs. The lcd.error R/O property will indicate 1- YES if there was a problem enabling the display.
TIDE and Tibbo BASIC User Manual .Fontpixelpacking R/O Property Indicates how pixels are packed into bytes in a currently Function: selected font. Enum (ver_hor, byte) Type: 0- PL_VERTICAL: Several vertically adjacent pixels are Value Range: packed into each byte of character bitmaps.
TIDE and Tibbo BASIC User Manual 15 -> gggggbbbbbbrrrrr <- bit 0. In this example, the green field is the last field and occupies 5 bits (15-11). .Height Property Sets the vertical resolution of the display panel in pixels. Function:...
TIDE and Tibbo BASIC User Manual Returns: Lines, Rectangles, and Fills lcd.rectangle lcd. See Also: filledrectangle lcd.fill Description X coordinate of the first point. Value range is 0 to lcd.width Y coordinate of the first point. Value range is 0 to lcd.height...
TIDE and Tibbo BASIC User Manual See Also: Understanding Controller Properties Working With Pixels and Colors Details Controller/panel selection is made through the Customize Platform dialog, accessible through the Project Settings dialog. Monochrome panels/controllers only allow you to turn pixels on and off. Grayscale panels/controllers allow you to set the brightness of pixels in steps.
TIDE and Tibbo BASIC User Manual For this method to work, a font must first be selected with the lcd.setfont method. The lcd.textalignment lcd.textorientation lcd.texthorizontalspacing , and lcd.textverticalspacing properties will affect how the text is printed. This method breaks the text into lines to stay within the specified rectangular output area.
TIDE and Tibbo BASIC User Manual Details A valid font file must be selected before you can use the lcd.print lcd. printaligned , or lcd.getprintwidth methods. Naturally, the font file must be present in your project for this to work (see how to a font file).
TIDE and Tibbo BASIC User Manual 0- PL_LCD_TEXT_ORIENTATION_0: At 0 degrees Value Range: (default). 1- PL_LCD_TEXT_ORIENTATION_90: At 90 degrees. 2- PL_LCD_TEXT_ORIENTATION_180: At 180 degrees. 3- PL_LCD_TEXT_ORIENTATION_270: At 270 degrees. See Also: Working With Text lcd.textalignment lcd.texthorizontalspacing lcd.textverticalspacing Details .Textverticalspacing Property...
Your flash memory's primary use is to store the firmware of your device, as well as compiled Tibbo Basic application. The firmware/ application typically occupy only a part of the flash memory. Available space will be referred to as the "data area"...
The .fd object uses the same physical flash chip that stores the firmware of your device, as well as your Tibbo Basic application. The flash memory consists of 264- byte sectors. It is customary to use 256 bytes of each sector to store actual data, and reserve the rest for "service"...
This approach was chosen to minimize the influence of the changing size of your Tibbo Basic application on the data you keep in the flash memory. Typically, the size of your application keeps changing as you develop and debug it. At the same time, you often need to keep certain data in the data area permanently, and don't want to recreate this data every time you load new iteration of your application.
TIDE and Tibbo BASIC User Manual Formatting is performed using the fd.format method. This method accepts, as arguments, two parameters: total number of sectors occupied by the disk, and the maximum number of files that you wish to be able to store on the disk.
TIDE and Tibbo BASIC User Manual that you wish the disk to occupy. From that, and the supplied desired max number of files, the fd.format will work out the size of each area of the disk. Let's see this on a real example: Supposing, you call fd.format(1300,41) -- you want the disk to occupy 1300 sectors and store 41 file.
TIDE and Tibbo BASIC User Manual Checking Disk Vitals Once the disk is mounted , you can check several important flash disk parameters: Fd.capacity will tell you the number of usable data sectors on the disk (reminder: each sector stores 256 bytes of data).
The concept of file numbers is not new -- other operating systems, too, assign a number to the file when the file is opened. In Tibbo Basic, you select the number you want to open the file on yourself. You do this by selecting a desired value for the fd.filenum property:...
TIDE and Tibbo BASIC User Manual is fd.filesize+1! When the pointer is at maximum, it effectively points at the file position that doesn't exist yet. So, writing to the file at this position will append new data to the end of the file. Writing to the file when the pointer is not at maximum will overwrite existing data.
Page 463
TIDE and Tibbo BASIC User Manual As dword 'try to find the 2nd occurrence of 'ABC', search forward starting at the beginning of the file dw=fd.find(1,"ABC",2,FORWARD,1) fd.laststatus<>PL_FD_STATUS_OK Then 'some disk-related error Else dw<>0 Then 'found! process this... Else 'not found...
Page 465
TIDE and Tibbo BASIC User Manual Reading data from a sector is a two-step process. First, you use fd.getsector load all 264 bytes from desired sector into the currently selected RAM buffer. Next, you use fd.getbuffer to read the data from the selected buffer. This method...
Page 467
TIDE and Tibbo BASIC User Manual 16-bit values for these calculations are little-endian. That is, offset 0 of the sector is presumed to be the high byte of the first 16-bit value, offset 1 -- low byte of the first 16-bit value, offset 2 -- high byte of the second 16-bit value, and so on.
As was explained under Direct Sector Access , you can't use fd.setsector write to the flash area occupied by the firmware and Tibbo Basic application. This is done to prevent your application from inadvertently damaging its own code or the firmware. A special fd.copyfirmware...
TIDE and Tibbo BASIC User Manual File-based and Direct Sector Access Coexistence File-based direct sector access methods can be used at the same time, as long as you understand how direct access may affect (and possibly screw up) the flash disk.
Maintaining the data integrity is a very important task, and the one where the flash memory needs a lot of help from your smart Tibbo Basic application. The biggest source of potential trouble is a sudden loss of power right in the middle of writing to the flash IC.
Page 471
TIDE and Tibbo BASIC User Manual losing the old and the new contents of the sector. For many flash disk operations , a single operation requires making changes to several sectors. For example, creating a file requires to change data both in the file record table (FRT) and the file allocation table (FAT).
Platforms Details The value of this property reflects free flash space not occupied by currently loaded Tibbo Basic application. You may use the fd.format method to create the flash disk as large as available flash space. Note that the actual capacity of the disk (fd.capacity...
TIDE and Tibbo BASIC User Manual The disk must be mounted (see fd.mount ) for this property to return a meaningful value. .Checksum Method Calculates or verifies the checksum for the data in the Function: currently selected RAM buffer of the flash memory (selection is made through the fd.buffernum...
Number of sectors to copy. sect Details This method allows you to remotely upgrade the firmware and the Tibbo Basic application of your device. First, your application can receive and store the new firmware into the unused area of the flash memory (see fd.availableflashspace...
TIDE and Tibbo BASIC User Manual You will need to physically go to your device and upload correct firmware through its serial port. .Cutfromtop Method Removes a specified number of sectors from the Function: beginning of a file opened "on" a currently selected file number (selection is made through the fd.filenum...
TIDE and Tibbo BASIC User Manual Each file always occupies at least one sector in the data area of the disk. The first sector is allocated when you invoke the fd.create method. This is why an attempt to create a new file may result in the 7- PL_FD_STATUS_DATA_FULL status code.
Page 481
TIDE and Tibbo BASIC User Manual fd.find(frompos as dword, byref substr as string, Syntax: instance as word, dir as forward_back, incr as word, mode as pl_fd_find_modes) as dword File position (counting from one) at which the target Returns: occurrence of the substr was discovered, or 0 if the target occurrence of the substr was not found.
TIDE and Tibbo BASIC User Manual .Format Method Formats the flash memory to create a flash disk. Function: fd.format(totalsize as word, numstoredfiles as byte) as Syntax: pl_fd_status_codes One of the following pl_fd_status_codes , also affects Returns: fd.laststatus 0- PL_FD_STATUS_OK: Completed successfully.
TIDE and Tibbo BASIC User Manual Description offs Starting offset in the buffer. Possible value range is 0-263 (the buffer stores 264 bytes of data, offset is counted from 0). Number of bytes to read. Will be corrected downwards if necessary.
TIDE and Tibbo BASIC User Manual The string containing the file name of the next directory Returns: member or an empty string if all file names have already been returned. The method also affects the state of the fd.laststatus . The following status codes are possible: 0- PL_FD_STATUS_OK: Completed successfully.
TIDE and Tibbo BASIC User Manual 0- PL_FD_STATUS_OK: Completed successfully (default) Value Range: 1- PL_FD_STATUS_FAIL : Physical flash memory failure (fatal). 2- PL_FD_STATUS_CHECKSUM_ERR: Checksum error has been detected in one of the disk sectors (fatal). 3- PL_FD_STATUS_FORMAT_ERR: Disk formatting error has been detected (fatal).
TIDE and Tibbo BASIC User Manual The disk will also be dismounted if your application invokes the fd.format method or uses the fd.setsector to write to a sector belonging to a mounted flash disk (sectors 0 thru fd.totalsize -1). .Numservicesectors R/O Property...
TIDE and Tibbo BASIC User Manual Details Use the fd.mount method to mount this disk. .Rename Method Renames a file specified by its name. Function: fd.create(byref old_name as string, byref new_name Syntax: as string) as pl_fd_status_codes One of the following...
TIDE and Tibbo BASIC User Manual One of the following pl_fd_status_codes , also affects Returns: fd.laststatus 0- PL_FD_STATUS_OK: Completed successfully. 1- PL_FD_STATUS_FAIL : Physical flash memory failure (fatal). 2- PL_FD_STATUS_CHECKSUM_ERR: Checksum error has been detected in one of the disk sectors (fatal).
TIDE and Tibbo BASIC User Manual Details As a result of this method invocation, the pointer (see fd.pointer ) will be advanced forward by the number of bytes written to the file. If the pointer wasn't at the end of the file (at fd.filesize...
You can only write to "free" flash sectors that are not occupied by the firmware or Tibbo Basic application of your device. The number of free sectors can be determined through the fd.availableflashspace R/O property. Trespassing this boundary will result in the 1- PL_FD_STATUS_FAIL status code.
Page 501
TIDE and Tibbo BASIC User Manual On platforms with output buffer control , all intended scan lines should be configured as outputs, and all return lines -- as inputs (see io.num io.enabled Scan lines can optionally perform a double duty and drive LEDs. One such LED can be connected to each scan line, preferably through a buffer, as shown on the drawing below.
TIDE and Tibbo BASIC User Manual Possible state transitions are indicated by arrows. Red arrows show transitions for when the key is pressed (or remains pressed), blue -- for when the key is released (or remains released). The time it takes for the key to transition from one state to another is quantified in 10ms intervals.
TIDE and Tibbo BASIC User Manual different properties are responsible for that: kp.pressdelay kp.longpressdelay kp.repeatdelay kp.releasedelay , and kp.longreleasedelay . Each property sets the transition delay time in 10ms increments. Setting a property to 0 means that the corresponding transition will never happen. Note that the maximum value for each property is 254, not 255.
Page 507
TIDE and Tibbo BASIC User Manual kp.scanlinesmapping="24,25,26,27" kp.returnlinesmapping="28,29,30,31" io.num=PL_IO_NUM_24 io.enabled=YES io.num=PL_IO_NUM_25 io.enabled=YES io.num=PL_IO_NUM_26 io.enabled=YES io.num=PL_IO_NUM_27 io.enabled=YES 'we are not going to change default delay values -- we like them as they are (we came up with them, after all) kp.autodisablecodes=str(PL_KP_EVENT_PRESSED)+",49"...
TIDE and Tibbo BASIC User Manual Details The keypad matrix is being scanned and your application receives the on_kp on_kp_overflow events only when the keypad is enabled (kp.enabled= 1- YES). The following properties can be changed only when the keypad is disabled (kp.
TIDE and Tibbo BASIC User Manual The keypad buffer stores up to 16 keypad events. Each such event causes the on_kp generation. If your application is slow to process the keypad events, it is possible to overflow the keypad by pressing the keys in rapid succession. Once the buffer overflows, the keypad is disabled automatically (kp.enabled...
TIDE and Tibbo BASIC User Manual keypad must have at least one return line to be able to work. Return lines of the keypad should be separate from the scan lines (see scanlinesmapping ). The keypad will not work properly if you designate any I/O line as both a scan and return line.
Detect disassociation from the network. Detect Wi-Fi interface power-down or malfunction. The present incarnation of the wln object is intended to work with Tibbo's GA1000 802.11b/g add-on board. Previous version of the .wln object worked with the now obsolete WA1000 add-on board.
TIDE and Tibbo BASIC User Manual Setting MAC address (wln.mac ): it is now optional. The Wi-Fi add-on has a factory-assigned MAC. Leave the wln.mac uninitialized ("0.0.0.0.0.0"), boot up ( wln.boot ) and the pre-assigned MAC will be used.
Tibbo Basic application execution to wait for the wln interface to complete required operation ("task"). You program gives the wln object a task to perform, and then it is free to go and do other things.
Page 517
TIDE and Tibbo BASIC User Manual The wln object can only work on a single task at a time. You cannot request another task execution until the previous one is finished! The following example shows a wrong way of tasking: 'THIS WON'T WORK! wln.scan("NET1")
Wi-Fi hardware, after which the boot process can be repeated. The on_wln_event is generated when the GA1000 goes offline, either as a result of a deliberate reset, or in case the Wi-Fi hardware malfunctions. Transition between the idle and associated states happens as a result of successful association.
'----- set MAC address (optional) ----- wln.mac="0.100.110.120.130.140" '----- set domain ----- wln.domain=PL_WLN_DOMAIN_FCC '----- boot up the GA1000 ----- romfile.open("ga1000fw.bin") wln.boot(romfile.offset) '----- setup the IP, gateway, netmask ----- wln.ip="192.168.1.86" wln.gatewayip="192.168.1.1" wln.netmask="255.255.255.0" '----- set TX power (optional) ----- wln.settxpower(15)
Applying Reset The Wi-Fi module requires a hardware reset for correct operation and there is a dedicated reset (RST) inteface pin for that. Any I/O line of your Tibbo module can be used to control the reset line. To reset the Wi-Fi module, enable the GPIO line that controls the reset (let's assume it is GPIO #51) and set it to LOW first, HIGH next.
TIDE and Tibbo BASIC User Manual Configuring Interface Lines The Wi-Fi module interacts with your BASIC-programmable module through an SPI interface. The SPI interface has four signals: chip select (CS), clock (CLK), data in (DI), and data out (DO). Any four I/O lines of your programmable module can be selected to control the SPI interface.
Wi-Fi module, and this is what wln.boot really does. The firmware file is called "ga1000fw.bin" (the file can be downloaded from Tibbo website). The file must be added to your Tibbo Basic project as a binary resource file .
). We noticed that many people find it "unusual" that Tibbo hardware device would turn out to have two IP addresses. In fact, this is completely normal. On the PC, every network interface has an IP of its own as well.
Platforms After the execution of the above, s string may contain something like this: "TIBBO, c1100_1,WNET2". When called with the argument set to the name of a particular network, the wln. scan method will return additional data on this network: Wln.scanresultssid...
TIDE and Tibbo BASIC User Manual Wi-Fi devices routinely define four WEP keys, but Tibbo hardware only uses a single key (key 1). Associating With Selected Network Association is a process by which your Wi-Fi device establishes a network link with an access point or another wireless station running an ad-hoc network.
TIDE and Tibbo BASIC User Manual Rebooting Rebooting is done by applying a hardware reset to the Wi-Fi module. When the Wi-Fi interface add-on goes offline, the wln object will detect this in a matter of milliseconds. Your application can stay and wait for this:...
TIDE and Tibbo BASIC User Manual After the successful association, which is initiated through the wln.associate method, the value of this property changes to 1- PL_WLN_ASSOCIATED. The value is reset back to 0- PL_WLN_NOT_ASSOCIATED if disassociation occurs. Every time this happens, an...
TIDE and Tibbo BASIC User Manual .Clkmap Property Sets/returns the number of the I/O line which will control Function: the clock (CLOCK) input of the Wi-Fi module's SPI interface. Enum (pl_io_num, byte) Type: Platform-specific. See the list of pl_io_num constants in Value Range: the platform specifications.
TIDE and Tibbo BASIC User Manual Details This property can't be changed while the Wi-Fi hardware is operational (wln. enabled = 1- YES). Note that domain selection only affects association (wln. associate ), not the scanning process (wln.scan ) or the ability of the Wi-Fi interface to start its own ad-hoc network (wln.networkstart...
<> 0- PL_SSTS_CLOSED and sock.currentinterface = 2- PL_INTERFACE_WLN. The GA1000 add-on board already has a proper MAC address internally. To use this MAC, leave the wln.mac at "0.0.0.0.0.0" when booting up the wln interface with the wln.boot method. After a successful boot,the wln.mac property will contain the MAC address obtained form the GA1000.
TIDE and Tibbo BASIC User Manual wln_ Registered event: event 0- PL_WLN_EVENT_DISABLED: Wi-Fi hardware has been disconnected, powered down, or is malfunctioning. 1- PL_WLN_EVENT_DISASSOCIATED: Wi-Fi interface has been disassociated from the wireless network. Details Multiple on_wln_event events may be waiting in the event queue.
TIDE and Tibbo BASIC User Manual The task is completed when the wln.task R/O property becomes 0- PL_WLN_TASK_IDLE. The on_wln_task_complete event will also be generated at that time. After the completion, the following read-only properties will be updated: If the ssid argument was left empty, the wln.scanresultssid...
TIDE and Tibbo BASIC User Manual Details If the wln.scan method was invoked with its name argument left empty, the wln.scanresultssid will contain the list of all discovered networks. If the name argument specified a particular network and scanning found this network to be present, then this property will contain the name of this network.
TIDE and Tibbo BASIC User Manual 0- PL_WLN_TASK_IDLE (default): No task is in progress. Value Range: 1- PL_WLN_TASK_SCAN: Scan task is in progress (initiated by wln.scan 2- PL_WLN_TASK_ASSOCIATE: Association task is in progress (initiated by wln.associate 3- PL_WLN_TASK_SETTXPOWER: TX power adjustment is in progress (initiated by wln.settxpower...
Page 547
TIDE and Tibbo BASIC User Manual Creating, Deleting, and Renaming Files , expanded topic content. Changes in the sock object manual: - Updated sock.close sock.reset , and sock.discard topics -- these methods are ignored when called from within an HTML page;...
Page 548
Corrected a mistake in the Main Parameters topic (net object). The topic incorrectly stated that the Tibbo Basic application can't change the MAC address, which is, in fact, possible. Correction: default value for the net.ip property is "1.0.0.1", not "127.0.0.1".
Page 549
TIDE and Tibbo BASIC User Manual Expanded Establishing Outgoing Connections Closing Connections topics. Both topics now contain "Do not forget! Connection Handling is fully asynchronous" sections. Added "Socket re-use after connection closing" section to the Closing Connections topic.
Page 557
TIDE and Tibbo BASIC User Manual memory capacity on_sock_event menu on_sock_inband messages embedded within the TCP data stream on_sock_overrun on_sock_tcp_packet_arrival on_sys_init 212, 220 mincount on_sys_timer minimalistic on_wln_event minutes on_wln_task_complete MOD Operator OR Operator month - P - more than one serial port...
Need help?
Do you have a question about the GA1000 and is the answer not in the manual?
Questions and answers