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

Page 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)

Image 48
Contents Jackrabbit BL1800 Programmable Single-Board ComputerTrademarks Digi International IncTable of Contents Index Schematics Features IntroductionJackrabbit Features Development and Evaluation ToolsHow to Use This Manual Additional Product InformationOnline Documentation CE Compliance ImmunityEmissions Safety Design Guidelines GeneralInterfacing the Jackrabbit to Other Devices Jackrabbit BL1800 Development Kit Contents Getting StartedDevelopment Hardware Connections Board Attach Jackrabbit to Prototyping BoardConnect Programming Cable Assemble AC AdapterConnect Power Installing Dynamic C Troubleshooting Run a Sample ProgramWhere Do I Go From Here? Real-Time ClockTechnical Support Subsystems BL1800Jackrabbit Pinouts HeadersDigital Inputs/Outputs Digital InputsDigital Outputs HV3 Sourcing OutputConfigurable High-Current Output Bidirectional I/O Changing HV3 to a Sinking OutputSchematic Diagram of A/D Converter A/D ConverterJackrabbit BL1800 Schematic Diagram of D/A Converters D/A ConvertersV ⋅ 1 e RC 1 DA1Typical DA1 Voltages for Various Duty Cycles 2 DA0 Typical DA0 Voltages for Various Duty CyclesUser’s Manual Serial Communication 1 RS-2322 RS-485 Ground recommended Programming Port 485 R16User’s Manual Changing Between Program Mode and Run Mode Programming CableMemory SramFlash Eprom Other Hardware External InterruptsClock Doubler Spectrum Spreader Jackrabbit BL1800 Software Reference An Overview of Dynamic CJackrabbit BL1800 Sample Programs Jackrabbit Sample ProgramsDEMOJR1.C Sample Program DEMOJR1.C Single-Stepping Watch Expression Break PointSummary of Features Editing the ProgramWatching Variables Dynamically User’s Manual Other Sample Programs Illustrating Digital I/O R/W pin and DB0-DB3 on 3 RS-232 Serial Communication Sample Programs 4 RS-485 Serial Communication Sample Program Cooperative Multitasking Int vswitch Advantages of Cooperative Multitasking Jackrabbit Function Calls 1 I/O DriversVoid digOutint channel, int value Void anaOutint channel, int value Void anaInint channel, int *value Serial Communication Drivers Upgrading Dynamic C Patches and Bug FixesAdd-On Modules Appendix A. Specifications Electrical and Mechanical Specifications Figure A-1shows the mechanical dimensions for the JackrabbitTable A-1. Jackrabbit Board Specifications Exclusion Zone Exclusion ZonesFigure A-3. User Board Footprint for Jackrabbit Jumper Configurations Figure A-4. Location of Jackrabbit Configurable PositionsTable A-2. Jackrabbit Jumper Configurations Conformal Coating Conformally coated areaUse of Rabbit 2000 Parallel Ports JackrabbitTable A-3. Jackrabbit Pinout Configurations PD0 PD1 Jackrabbit BL1800 Appendix B. Prototyping Board Jackrabbit Connectors User LEDs Buzzer Prototyping Board OverviewPrototyping Board Features Mechanical Dimensions and Layout Top SideUsing the Prototyping Board Top SideDemonstration Board RelayExisting Prototyping Board Top SidePE0 VCC HV0 SM1 SM0 HV2 Stat Jackrabbit BL1800 Appendix C. Power Management Power SuppliesDcin Current mA Batteries and External Battery Connections 950 mA·h = 5.4 years 20 µABattery Backup Circuit Figure C-5shows the Jackrabbit battery backup circuitryPower to Vram Switch Reset GeneratorFigure C-7shows a schematic of the chip select circuit Chip Select CircuitJackrabbit BL1800 Index SMODE0 SMODE1RABDB01.C RABDB02.C Schematics