參數(shù)資料
型號(hào): DM6210
廠商: Electronic Theatre Controls, Inc.
英文描述: dataModule medium speed analog input module
中文描述: 數(shù)據(jù)模塊中速模擬輸入模塊
文件頁(yè)數(shù): 41/91頁(yè)
文件大?。?/td> 1098K
代理商: DM6210
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 EF
_
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
相關(guān)PDF資料
PDF描述
DM7400 Quad 2-Input NAND Gates
DM7400M PCB MOUNT PRESSURE SENSOR
DM7400N Quad 2-Input NAND Gates
DM7402 Quad 2-Input NOR Gates
DM7402N Quad 2-Input NOR Gates
相關(guān)代理商/技術(shù)參數(shù)
參數(shù)描述
DM62J11B205DO 制造商:CK-COMPONENTS 制造商全稱:C&K Components 功能描述:Miniature 2 Pole Power Rocker Switches
DM62J11B205DQ 制造商:ITT 制造商全稱:ITT Industries 功能描述:Miniature 2 Pole Power Rocker Switches
DM62J11B205HO 制造商:CK-COMPONENTS 制造商全稱:C&K Components 功能描述:Miniature 2 Pole Power Rocker Switches
DM62J11B205HQ 制造商:ITT 制造商全稱:ITT Industries 功能描述:Miniature 2 Pole Power Rocker Switches
DM62J11B205O 制造商:CK-COMPONENTS 制造商全稱:C&K Components 功能描述:Miniature 2 Pole Power Rocker Switches