Zbasic System Library Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
ZBasic System Library Reference Manual Version 3.1.1 Copyright © 2005-2010 Elba Corp. All rights Reserved. Publication History November 2005 First publication February 2006 Minor corrections May 2006 Added new routine descriptions, minor corrections October 2006 Added new routine descriptions, minor corrections February 2007 Added information on new ZX models August 2007 Updated for a new ZX model and added new routine descriptions March 2008 Updated for new ZX models and added new routine descriptions October 2008 Added new routine descriptions January 2009 Added information on a new ZX model April 2009 Added new routine descriptions, minor corrections June 2009 Updated for new ZX models January 2010 Updated routine descriptions, added new descriptions June 2010 Updated for new ZX models October 2010 Updated for new ZX models Disclaimer Elba Corp. makes no warranty regarding the accuracy of or the fitness for any particular purpose of the information in this document or the techniques described herein. The reader assumes the entire responsibility for the evaluation of and use of the information presented. The Company reserves the right to change the information described herein at any time without notice and does not make any commitment to update the information contained herein. No license to use proprietary information belonging to the Company or other parties is expressed or implied. Trademarks ZBasic, ZX-24, ZX-24a, ZX-24n, ZX-24p, ZX-24r, ZX-24s, ZX-24x, ZX-40, ZX-40a, ZX-40n, ZX-40p, ZX- 40r, ZX-40s, ZX-44, ZX-44a, ZX-44n, ZX-44p, ZX-44r, ZX-44s, ZX-328n, ZX-328l, ZX-32n, ZX-32l, ZX- 1280, ZX-1280n, ZX-1281, ZX-1281n, ZX-32a4 and ZX-128a1 are trademarks of Elba Corp. ZX-24e, ZX-24ae, ZX-24ne, ZX-24pe, ZX-24nu, ZX-24pu, ZX-24ru, ZX-24su, ZX-24xu, ZX-328nu, ZX- 128e, ZX-128ne, ZX-1281e and ZX-1281ne are trademarks of Oak Micros used under license from Elba Corp. AVR is a registered trademark of Atmel Corp. BasicX, BX-24 and BX-35 are trademarks of NetMedia, Inc. PBasic is a trademark and Basic Stamp is a registered trademark of Parallax, Inc. Visual Basic is a registered trademark of Microsoft Corp. Other brand and product names are trademarks or registered trademarks of their respective owners. Table of Contents Routines by Category.................................................................................................................1 Type Conversion Functions..................................................................................................1 Mathematical Functions.........................................................................................................1 Memory-related Routines......................................................................................................2 String-related Routines..........................................................................................................2 Input/Output Routines............................................................................................................3 Serial Communication Routines...........................................................................................4 Queue Management Routines .............................................................................................4 Date/Time Routines ...............................................................................................................4 Data Manipulation Routines..................................................................................................5 Task-related Routines............................................................................................................5 Miscellaneous Routines.........................................................................................................5 Resource Usage..........................................................................................................................7 USART .....................................................................................................................................7 SPI Interface............................................................................................................................8 Analog-to-Digital Converters.................................................................................................9 Interrupts..................................................................................................................................9 Interrupt Service Routines...................................................................................................10 Timers.....................................................................................................................................13 Detailed Descriptions................................................................................................................16 Abs..........................................................................................................................................19 Acos........................................................................................................................................20 ADCtoCom1 ..........................................................................................................................21 Asc..........................................................................................................................................22 Asin.........................................................................................................................................23 Atn...........................................................................................................................................24 Atn2.........................................................................................................................................25 BitCopy...................................................................................................................................26 BlockMove .............................................................................................................................27 BusRead ................................................................................................................................28 BusWrite.................................................................................................................................29 CallTask .................................................................................................................................30 CBit .........................................................................................................................................32 CBool......................................................................................................................................33 CByte......................................................................................................................................34 CByteArray ............................................................................................................................35 Ceiling.....................................................................................................................................36 Chr ..........................................................................................................................................37 CInt .........................................................................................................................................38 ZBasic System Library iii ZX Microcontroller Family ClearQueue ...........................................................................................................................39 CLng .......................................................................................................................................40 CloseCom..............................................................................................................................41 CloseDAC..............................................................................................................................42 CloseI2C ................................................................................................................................43 ClosePWM.............................................................................................................................44 ClosePWM8...........................................................................................................................45 CloseSPI................................................................................................................................46 CloseWatchDog....................................................................................................................47 CloseX10 ...............................................................................................................................48 CNibble...................................................................................................................................49 Com1toDAC ..........................................................................................................................50 ComChannels .......................................................................................................................51 Console.Read .......................................................................................................................53 Console.ReadLine................................................................................................................54