Digi BL1800 user manual Cooperative Multitasking

Page 52

4.3 Cooperative Multitasking

Cooperative multitasking is a convenient way to perform several different tasks at the same time. An example would be to step a machine through a sequence of steps and at the same time independently carry on a dialog with the operator via a human interface. Coop- erative multitasking differs from a different approach called preemptive multitasking. Dynamic C supports both types of multitasking. In cooperative multitasking each separate task voluntarily surrenders its compute time when it does not need to perform any more activity immediately. In preemptive multitasking control is forcibly removed from the task via an interrupt.

Dynamic C has language extensions to support multitasking. The major C constructs are called costatements, cofunctions, and slicing. These are described more completely in the Dynamic C User’s Manual. The example below, sample program DEMOJR3.C, uses cos- tatements. A costatement is a way to perform a sequence of operations that involve pauses or waits for some external event to take place. A complete description of costatements is in the Dynamic C User’s Manual. The DEMOJR3.C sample program has two independent tasks. The first task flashes LED DS4 once a second. The second task uses button S1 on the Prototyping Board to toggle the logical value of a virtual switch, vswitch, and flash DS1 each time the button is pressed. This task also debounces button S1.

48

Jackrabbit (BL1800)

Image 52
Contents Jackrabbit BL1800 Programmable Single-Board ComputerTrademarks Digi International IncTable of Contents Index Schematics Features IntroductionJackrabbit Features Development and Evaluation ToolsAdditional Product Information How to Use This ManualOnline Documentation Immunity CE ComplianceEmissions Design Guidelines General SafetyInterfacing 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 ProgramReal-Time Clock Where Do I Go From Here?Technical 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 1 RS-232 Serial Communication2 RS-485 Ground recommended Programming Port 485 R16User’s Manual Changing Between Program Mode and Run Mode Programming CableSram MemoryFlash Eprom External Interrupts Other HardwareClock Doubler Spectrum Spreader Jackrabbit BL1800 Software Reference An Overview of Dynamic CJackrabbit BL1800 Sample Programs Jackrabbit Sample ProgramsDEMOJR1.C Sample Program DEMOJR1.CSingle-Stepping Watch Expression Break PointEditing the Program Summary of FeaturesWatching 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 Patches and Bug Fixes Upgrading Dynamic CAdd-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