4-9
Programming the DM6210
This section gives you some general information about programming and the DM6210.
The module is programmed by reading from and writing to the correct I/O port locations. These I/O ports
were defined in the previous section. Most high-level languages such as BASIC, Pascal, C, and C++, and of
course assembly language, make it very easy to read/write these ports. The table below shows you how to read
from and write to I/O ports using some popular programming languages.
In addition to being able to read/write the I/O ports on the DM6210, you must be able to perform a variety
of operations that you might not normally use in your programming. The table below shows you some of the
operators discussed in this section, with an example of how each is used with C, Pascal, and BASIC. Note that
the modulus operator is used to retrieve the least significant byte (LSB) of a two-byte word, and the integer
division operator is used to retrieve the most significant byte (MSB).
Many compilers have functions that can read/write either 8 or 16 bits from/to an I/O port. For example,
Turbo Pascal uses
Port
for 8-bit port operations and
PortW
for 16 bits, Turbo C uses
inportb
for an 8-bit read
of a port and
inport
for a 16-bit read.
Be sure to use the correct operation for each register on the DM6210.
Clearing and Setting Bits in a Port
When you clear or set one or more bits in a port, you must be careful that you do not change the status of
the other bits. You can preserve the status of all bits you do not wish to change by proper use of the AND and
OR binary operators. Using AND and OR, single or multiple bits can be easily cleared in one operation. Note
that most registers in the DM6210 cannot be read back; therefore, you must save the value in your program.
To
clear
a single bit in a port, AND the current value of the port with the value b, where b = 255 - 2
bit
.
Example:
Clear bit 5 in a port. Read in the current value of the port, AND it with 223
(223 = 255 - 2
5
), and then write the resulting value to the port. In BASIC, this is programmed as:
V_SAVE = V_SAVE AND 223
OUT PortAddress, V
/DQJXDJH
0RGXOXV
,QWHJHU 'LYLVLRQ
$1'
25
&
D EF
D EF
D E F
_
D E_F
3DVFDO
02'
D E02'F
',9
D E',9F
$1'
D E$1'F
25
D E25F
/DQJXDJH
5HDG%LWV
:ULWH%LWV
5HDG %LWV
:ULWH %LWV
7XUER&
'DWD LQSRUWE$GGUHVV RXWSRUWE$GGUHVV'DWD 'DWD LQSRUW$GGUHVV
RXWSRUW$GGUHVV'DWD
7XUER3DVFDO
'DWD 3RUW>$GGUHVV@
3RUW>$GGUHVV@ 'DWD
'DWD 3RUW:>$GGUHVV@
3RUW:>$GGUHVV@ 'DWD
Содержание DM6210
Страница 2: ......
Страница 9: ...i 1 INTRODUCTION...
Страница 10: ...i 2...
Страница 14: ...1 2...
Страница 22: ...1 10...
Страница 24: ...2 2...
Страница 28: ...2 6...
Страница 30: ...3 2...
Страница 34: ...4 2...
Страница 44: ...5 2...
Страница 48: ...5 6...
Страница 50: ...6 2...
Страница 56: ...6 8...
Страница 57: ...7 1 CHAPTER 7 TIMER COUNTERS This chapter explains the 8254 timer counter circuits on the DM6210...
Страница 58: ...7 2...
Страница 61: ...8 1 CHAPTER 8 DIGITAL I O This chapter explains the digital I O circuitry on the DM6210...
Страница 62: ...8 2...
Страница 65: ...9 1 CHAPTER 9 EXAMPLE PROGRAMS This chapter discusses the example programs included with the DM6210...
Страница 66: ...9 2...
Страница 68: ...9 4...
Страница 70: ...10 2...
Страница 74: ...10 6...
Страница 75: ...A 1 APPENDIX A DM6210 SPECIFICATIONS...
Страница 76: ...A 2...
Страница 78: ...A 4...
Страница 79: ...B 1 APPENDIX B CN3 CONNECTOR PIN ASSIGNMENTS...
Страница 80: ...B 2...
Страница 82: ...B 4...
Страница 83: ...APPENDIX C COMPONENT DATA SHEETS C 1...
Страница 84: ......
Страница 85: ...Intel 82C54 Programmable Interval Timer Data Sheet Reprint...
Страница 86: ......
Страница 88: ...D 2...
Страница 90: ...D 4 RTD Embedded Technologies Inc 103InnovationBlvd StateCollegePA16803 0906 USA Ourwebsite www rtd com...
Страница 91: ...DM6210 User Settings Base I O Address hex decimal IRQ Channel...