ZBasic comes with a wealth of free source code to do different things.
One of the reasons it is free is because BASIC code is so quick and easy learn and
write people don't value it highly so they tend to give it away. Our EFI system
will follow that reasoning so you can understand exactly how it works,
what it does and when it does it.
BTW As I recall Mark S from Texas used a ultrasonic distance detector
mounted on the landing gear to help in landing.
Here is an ap note with Source Code that does just that:
AN215 - Measuring Distance using Ultrasonic Echos and Timer1 06 March 2006
This application note illustrates how to connect a Devantech SRF05 Ultrasonic Range
Finder. The code can be also be used for the SRF04 and the concepts can be applied to many
other rangefinder devices as well.
LIST OF AP NOTES.
http://www.zbasic.net/appnotes.php
All the available application notes are listed below. Note that some have an accompanying
.zip file with source code.
AN221 - Interfacing Rotary Encoders 12 January 2009
Source Code
A rotary encoder can be a useful human interface element for many projects. This
application note presents information on rotary encoders and describes how to interface
them to a ZX microcontroller (or other microcontroller). Example code is included
demonstrating the ideas described.
AN220 - Interfacing a Parallel LCD 24 June 2008
Source Code
This application note presents three methods for connecting an inexpensive character
oriented parallel LCD to a ZX microcontroller (or other microcontroller) using 7, 3 or 2
I/O lines. Example code is included containing the necessary interface code plus a
collection of useful higher level routines for managing the LCD and displaying characters.
Although the example code is written for a 2x16 LCD (two rows, sixteen columns), it can be
easily adapted to displays with other geometries.
AN219 - Implementing I2C and SPI Slaves 21 June 2008
Source Code
With the introduction of native mode ZX devices it became possible to implement a broader
range of applications, notable among which are applications that require a customized
interrupt service routine (ISR). Due to the interface timing requirements, implementing an
I2C or SPI slave requires a customized ISR (in most cases). This application note
illustrates how to implement both an I2C slave and an SPI slave on a native mode ZX
device. The source code accompanying this application note contains example I2C and SPI
slave implementations along with simple test drivers (i.e. a master) for each slave.
AN218 - Implementing an RS-485 Multi-drop Network 26 January 2007
Source Code
RS-485 networks are used by many industrial applications including process control,
building automation and even the control of lights at a concert. This application note
describes the simple hardware required to get started with networking ZX devices. The
accompanying software provides a sample application and a reusable set of APIs to send and
receive messages on a RS-485 network.
AN217 - Measuring the Power Supply Voltage 27 October 2006
Source Code
Some applications, particularly ones that are battery powered, may need a way to monitor
the power supply voltage. Doing so using the on-board A/D converter requires a special
technique that is described in this application note. The technique can be modified to
exploit other special features of the A/D converter as well.
AN216 - High Resolution Pulse Width Modulation Updated 11 August 2008
Source Code
Pulse width modulation (PWM) is a useful technique for many control applications. This
application note describes how to use the PWM capabilities of the ZX microcontrollers in
several ways including servo control, H-bridge motor control and digital-to-analog conversion.
AN215 - Measuring Distance using Ultrasonic Echos and Timer1 06 March 2006
Source Code
This application note illustrates how to connect a Devantech SRF05 Ultrasonic Range
Finder. The code can be also be used for the SRF04 and the concepts can be applied to many
other rangefinder devices as well.
AN214 - Interfacing with the LCD03 Text Display 01 March 2006
Source Code
This application note illustrates how to connect an LCD using the I2C interface. The
particular display used is the Devantech LCD03 but the concepts can be applied to many
other devices as well.
AN213 - External Device Interfacing 02 February 2006
Most microcontroller applications require the use of external devices. This application
note describes some techniques for connecting devices and describes the additional
interface circuitry that is sometimes required. Interfacing to low voltage devices is also
covered.
AN212 - Getting Hot with the TPA81 Thermal Sensor 26 January 2006 Source Code
This application note describes how to connect and use the Devantech TPA81 Thermal Sensor
array.
AN211 - Navigating the CMPS03 Magnetic Compass 24 January 2006 Source Code
This application note describes how to connect and use the Robot Electronics CMPS03
Magnetic Compass.
AN210 - Sharing Data Between Tasks 18 January 2006 Source Code
Multi-tasking is a powerful tool that simplifies programming complex systems. However,
properly implementing multi-tasking applications requires a good understanding of the
problems that can arise as the various tasks attempt to access data that is shared.
Fortunately, there are standard, well-known methods to avoid such problems; this
application note discusses how to apply them in ZBasic.
AN209 - Task Management 02 January 2006
This application note describes some techniques for task management including a method to
implement a timeout for InputCapture().
AN208 - Using I2C with Devantech Ultrasonic Range Finders 30 December 2005 Source Code
Devices like the Devantech SRF10 ultrasonic range finder are commonly used in robots for
collision avoidance or object detection. This application note describes how to connect
and use the SRF10 using the I2C interface, exploiting the multi-tasking capability of
ZBasic to accommodate the ranging delay.
AN207 - Interfacing to SpeakJet Voice and Sound Synthesizer 26 December 2005 Source Code
The SpeakJet (from Magnevation LLC) is a completely self-contained, single chip voice and
complex sound synthesizer. This application note describes how to interface a SpeakJet
with a ZX chip and use ZBasic to generate speech or sounds using the SpeakJet chip.
AN206 - Using PlaySound to Generate Audio 07 December 2005 Source Code
The PlaySound subroutine synthesizes an audio signal using data from a digitized audio
stream. The interface to PlaySound is quite simple. The more difficult problem is how to
get the data into your ZX program. This application note shows how to produce a data
stream that is compatible with PlaySound starting from a .wav, .mp3 or other sound file.
The accompanying .zip file includes some audio samples and a conversion program that can
be used to produce 8-bit PlaySound-compatible data from real number data stream.
AN205 - Interfacing a Matrix Keyboard Updated 23 June 2008 Source Code
Some applications require a means of obtaining human input. Often, a small keypad (e.g. a
TouchTone keypad) is sufficient for this purpose. This application note illustrates
several ways to interface a matrix keypad.
AN204 - Input Capture and Multi-tasking for IR Remote Controls 30 November 2005 Source Code
This application note illustrates how to receive and decode signals from an infrared
remote control. Using these techniques as a foundation, you can easily add remote
controllability to your application.
AN203 - I/O Expansion Techniques 24 November 2005
What to do when you've run out of I/O pins? This application note describes some common
techniques for expanding the number of I/O lines available to your application.
AN202 - Using RCTime to Measure Charging Time 22 November 2005
The RCTime() function measures the time required for an input to change logic states. This
application note describes how to used this capability to determine the charge or
discharge time of a capacitor.
AN201 - Generating DTMF Using FreqOut 22 November 2005 Source Code
This application note demonstrates how to generate Dual-Tone Multi-Frequency signals.
Although DTMF was designed to control telephone switching equipment it can be used in
other applications as well.
Paul Lamar
--
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site.
http://www.rotaryeng.net
Youtube key word PaulLamar2
Copyright 1998-2009 All world wide rights reserved.