Tibbo technology - the Home of Advanced Serial Device Servers
Serial Device Servers
Site search    Login help

Login: 

Password: 

Home Products Downloads Support Order Register Contacts Jobs

Taiko Home - The main page

White Paper - All about Taiko

Tibbo BASIC - About the language

TiOS - Tibbo Operating System

TIDE - Tibbo Integrated Development Environment

Upload Procedure - Animated tutorial

Your First Project - Animated tutorial

Resources - Demo files and projects

Taiko Downloads - Get the files!

Taiko Docs - Technical Documentation

Taiko Code Tips - Tips on TBASIC programming


11 MARCH 2008
New TIDE and TiOS version released with new features (LCD, Wi-Fi, etc.)

This new release of TIDE and TiOS files includes many improvement to the stability and extended many new features. New features include Wi-Fi, LCD, keypad, IO interrupt, IO ports, flash disk, improved HEX editor, etc. We have also updated the documents to reflect the recent additions. There's a new demo on how to setup Wi-Fi available for download in our resource page.
More info...


05 OCTOBER 2007
New TIDE and TiOS version released

This release fixed bugs concerning TIDE stability, the syscall "instr", and HTML.
More info...


04 SEPTEMBER 2007
New TIDE version released

This TIDE release features all-new Project Browser and Parser. New Parser is much faster, and also understands local declarations and variables. Additionally, the tooltips (for variables, procedures, etc.) now allow HTML formatting.

The update also includes new TiOS firmware files for our hardware.
More info...


Taiko Code Tips


On this page we will share tips and interesting ideas related to programming with TBASIC. The content of this page is not limited to our own, if you have any interesting ideas or experiences related to programming with TBASIC that you would like to share with others, please send us an email at support@tibbo.com



Efficient use of storage space - 12 November 2007


Coming from PC based programming background, sometimes our coding habits becomes less efficient when dealing with storage space. This creates a problem of running out of memory when large amount of data (in term of an embedded device) needs to be stored and every byte of storage space counts!

Take for example, when we read / write strings to the EEPROM memory space using the "stor" object, we would have something like the following:

	dim x as string
	stor.setdata("142",1)
	x = stor.getdata(1,3)
	  
The above will store the string 142 into the first position of the EEPROM and we will retrieve this value as a string.

So, what if when we need to store it as a byte instead of string? Most of us would probably just do it like this:

	dim x as byte
	stor.setdata(142,1)
	x = val(stor.getdata(1,3))
	  
That would work fine, but notice that it is still taking up 3 bytes of memory space; there is a more memory efficient way to do this:

	dim x as byte
	stor.setdata(chr(142),1)
	x = asc(stor.getdata(1,1))
	  
Now, instead of taking but 3 bytes of storage space, we only use 1 byte by first converting 142 into the ASCII representation before we store it into the EEPROM. When we retrieve back the data, we just convert it back to its original number.


Using sock.redir with UDP - 16 OCTOBER 2007


On some of the platforms you can speed up the data transfer by using a technique called buffer redirection, which means that data bypasses the RX buffer and goes directly to the TX buffer of another object. This works great, but with one exception, which is when you are redirecting from a socket that is using UDP, which will generate what seems like "junk data".

The reason behind this is that since UDP packets has header information containing the size of the packet, without being processed by the BASIC program, the header is sent together with the data to the destination object's TX buffer. So, when working with UDP, please use the on_sock_data_arrival event handler.


Instead of using redirection like this:
	sock.num = 0
	sock.redir(PL_REDIR_SER0) 
	  
Change it to this:
	sock.num = 0
	ser.num = 0
	ser.setdata(sock.getdata(ser.txfree-ser.newtxlen))	
	  
voilĂ ! Now, the socket is ready to handle UDP!


Smart Code That Won't Work - 29 AUGUST 2007


Here's a good example where what seemingly is a smart and short code that just will not work! Orignially, this was the code used during one of our projects:

	dim f as byte
	for f=0 to 3
		ser.num=f
		ser.setdata("test")
		ser.send
	next f
	  

Ok, so this outputs the same string through all four serial port.

Suddenly, I thought... do I really need f? Here is my new way:

	for ser.num=0 to 3
		ser.setdata("test")
		ser.send
	next ser.num
	  

Wonderful! Only, it doesn't work!

For the cycle to be over, the ser.num must increment beyond the limit. That is, the cycle will be over when ser.num becomes 4. But you can't set it to 4 - this property is internally limited (to available serial ports 0...3). So writing ser.num=4 will still leave it at 3. So, the cycle will NEVER end.


Copyright Tibbo Technology Inc. 2001 - 2007   Tel: 886-2-26925443   E-mail: info@tibbo.com