发布于 2012-12-25 09:57:46
6楼
我在Start-up guide 6.9.20里看到的?,大家一块学学,看是否能够跟你的程序,参数对应起来
Table 6-26 Starting up NCK I/Os, drive no.: 4
Analog Out Analog In Analog In 8 Bits Out 16 Bits Out 16 Bits In
OUTA [1] INA [1] INA [2] OUT [9] OUT [18] IN [9]
... ... ...
OUT [17] OUT [33] IN [17]
1. Assign the logical drive number: 4,
select the module type: DMP-C.
2. To connect to the bus, set NCK Reset.
3. Set the number of *og inputs and outputs:
*og inputs: MD10300 = 2, *og outputs: MD 10310 = 1.
Set the number of digital inputs and output bytes:
3 bytes dig. inputs, of which 2 bytes are external, 1 byte internal:
MD10350 = 3,
4 bytes dig. outputs, of which 3 bytes are external, 1 byte internal:
MD10360 = 4.
4. Assign the *og inputs to the hardware:
MD 10362 [0] = 01040201
1st input byte
Slot on terminal block
Logical drive number
for 840D always = 01
MD 10362 [1] = 01040301
5. Assign the *og outputs to the hardware:
MD 10364 [0] = 01040101
6. Assign the digital inputs to the hardware:
MD 10366 [0] = 01040602
2 input bytes
Slot on terminal block
Logical drive number
for 840D always = 01
7. Assign the digital outputs to the hardware:
MD 10368 [0] = 01040401
MD 10368 [1] = 01040502
8. Set the weighting factors for the *og inputs / outputs:
MD 10320 = 10000
MD 10330= 10000
9. Set the option: Programmed *og output
10. Program:
$A_OUTA [1] = 5000
(Set *og output 1 to 5000 mV)
FROM $A_INA [1] > 4000 DO $A_OUT [9] = TRUE
(If *og input 1 > 4000 mV, set output 9)
R1 = $A_INA [1]
(Set value of *og input 1 in R parameter 1)
DO $A_OUT [9] = FALSE
(Reset digital output 9)
DO $A_OUTA [1] = 0
(Set *og output 1 to 0 mV)