Digi BL1800 user manual Other Sample Programs Illustrating Digital I/O

Models: BL1800

1 94
Download 94 pages 15.6 Kb
Page 48
Image 48

4.2.2 Other Sample Programs Illustrating Digital I/O

DEMOJR2.C—repeatedly flashes LED DS3 (which is controlled by PA2) on the Proto- typing Board.

This sample program also illustrates the use of the runwatch() function to allow Dynamic C to update watch expressions while running. To test this:

1.Add a watch expression for "k" under "Inspect:Add/Del Watch Expression."

2.Click "Add to top" so that it will be permanently in the watch list.

3.While the program is running, type <Ctrl+U> to update the watch window.

DEMOJR3.C—demonstrates the use of costatements to LED DS4 (which is controlled by PA3) on the Prototyping Board. This sample program will also watch button S1 (PB2) and toggle LED DS1 (which is controlled by PA0) on/off when pressed. Note that S1 presses are debounced by the software.

The pins on Parallel Port A can all be set as either outputs or as inputs via the slave port control register (SPCTR). Do not use Parallel Port A if the slave port is being used.

Bits 0–5 on Parallel Port B are always inputs, and bits 6–7 are always outputs. Do not use Parallel Port B if the slave port is being used.

JRIOTEST.C—exercises the JackRabbit's four digital output channels, the one analog input channel, and the two analog output channels.

JRIO_COF.C—demonstrates the use of cofunctions with the analog input driver. Before you run this sample program, connect DA1 to AD0 on header J7 of the Proto- typing Board to provide an input voltage. Once the sample program is running, it will read the input voltage ten times while another costatement is executed concurrently. The values will be printed out in the Dynamic C STDIO window at the end of the program.

Before running the RABDB01.C and the RABDB02.C sample programs, you will need to install 3 mm LEDs such as the Vishay Telefunken TLUR4400 at DS5–DS8 on the Jack- rabbit Prototyping Board. These LEDs are included with the Jackrabbit Development Kit.

RABDB01.C—flashes LEDs DS5–DS8 on the Jackrabbit Prototyping Board (which are connected to PA4–PA7) when corresponding switches S1–S4 (which are connected to PB2–PB5) are pressed. The buzzer, which is driven by HV0 from PE0, will also sound whenever switch S1 switch is pressed.

RABDB02.C—flashes LEDs DS5–DS8 on the Jackrabbit Prototyping Board (which are connected to PA4–PA7) when corresponding switches S1–S4 (which are connected to PB2–PB5) are pressed. The buzzer, which is driven by HV0 from PE0, will also sound whenever switch S1 switch is pressed.

44

Jackrabbit (BL1800)

Page 48
Image 48
Digi BL1800 user manual Other Sample Programs Illustrating Digital I/O