manufacturer of I/O-rich SBCs, operator interfaces, handheld instruments, and development tools for embedded control low cost single board computers, embedded controllers, and operator interfaces for scientific instruments & industrial control development tools for embedded control order our low cost I/O-rich embedded control products embedded controller manufacturer profile single board computers & embedded controllers development tools & starter kits for your embedded design operator interfaces with touchscreens and graphical user interface plug-in expansion modules for digital & analog I/O C language & Forth language integrated development tools, IDE single board and embedded computer accessories embedded controller enclosures, bezels, environmental gaskets
Table of Contents

Introduction

Digital I/O Wildcard Hardware

Connecting To Mosaic Controller

Selecting the Digital I/O Wildcard Address

Current Capability of the Digital Output Lines

Protecting the Input and Output Pins

Connecting to the Field Header

Digital I/O Wildcard Software

Setting the Direction of the I/O Lines

C Code to initialize the Digital I/O Wildcard

Forth Code to initialize the Digital I/O Wildcard

Controlling the I/O Lines

C Code to control the Digital I/O Wildcard

Forth Code to control the Digital I/O Wildcard

Digital I/O Wildcard Schematics (pdf)

Digital I/O Wildcard User Guide

<< Previous |

Forth Code to control the Digital I/O Wildcard
HEX
1      CONSTANT OUTPUT_HIGH
0      CONSTANT OUTPUT_LOW
 
C000 CONSTANT NIBBLE_0_ADDR \ Lines 0-3.
C001 CONSTANT NIBBLE_1_ADDR \ Lines 4-7.
C002 CONSTANT NIBBLE_2_ADDR \ Lines 8-11.
C003 CONSTANT NIBBLE_3_ADDR \ Lines 12-15.
C004 CONSTANT NIBBLE_4_ADDR \ Lines 16-19. Inputs only.
1       CONSTANT LINE_0
2       CONSTANT LINE_1
4       CONSTANT LINE_2
8       CONSTANT LINE_3
1       CONSTANT LINE_4
2       CONSTANT LINE_5
4       CONSTANT LINE_6
8       CONSTANT LINE_7
1       CONSTANT LINE_8
2       CONSTANT LINE_9
4       CONSTANT LINE_10
8       CONSTANT LINE_11
1       CONSTANT LINE_12
2       CONSTANT LINE_13
4       CONSTANT LINE_14
8       CONSTANT LINE_15
: Control_DIO ( byte1\u\byte2\byte3 -- )
\ Sets I/O line of specified nibble to the appropriate state (high or low).
\ byte1 = module number, u = nibble address, byte2 = line, byte3 = state.
\ Valid module numbers are 0-7.
\ Valid nibble addresses are NIBBLE_0_ADDR to NIBBLE_3_ADDR.
\ Valid lines are LINE_0 to LINE_15
\ Valid states are OUTPUT_HIGH or OUTPUT_LOW
locals{ &state &line &nibble_addr &module }
  &state
  IF \ set line high
    &line &nibble_addr &module SET.BITS
  ELSE \ set line low
    &line &nibble_addr &module CLEAR.BITS
  ENDIF
;
: Read_Nibble ( byte1\u –- byte2 | byte1 = module number, u = nibble addr )
\ Reads the current state of the Digital I/O nibble.
\ Valid module numbers are 0-7.
\ Valid nibble addresses are NIBBLE_0_ADDR to NIBBLE_4_ADDR.
\ Returns an unsigned character whose least significant nibble represents
\ the four I/O lines. For example, if nibble 1 is read and a 1 is returned
\ (0001 in binary), then line 4 is high and lines 5-7 are low. If 12 is
\ returned (1100 in binary) after reading nibble 3, then lines 12 and 13 are
\ low and lines 14 and 15 are high. The four most significant bits of the
\ returned byte do not matter.
locals{ &nibble_addr &module }
  &nibble_addr &module C@
;

Conclusion

Now you are ready to start using your Digital I/O Wildcard. All of the software routines listed in this document are also on the distribution CD that accompanies each Wildcard.

<< Previous |


Home|Site Map|Products|Manuals|Resources|Order|About Us
Copyright (c) 2006 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation