Isolated digital output programming
The four bit digital output port can directly be programmed from software by
writing output data to the high bits (4-8) of I/O-port address BA+3. Care must be taken to
ensure the lower four bits remain unchanged since they hold the configuration data of
your DM6854HR. The example below illustrates a safe way of controlling the digital outputs.
Example in "C" syntax:
// Step 1
store the current contents of the Control/Output register
reg_data = inp(BA+3);
// reg_data holds all information
conf_data = 0x0f && reg_data;
// mask lower bits to store configuration
// Step 2
prepare output data stored in variable out_data
out_data = out_data<<4;
// shift left 4 bits
// Step 3
combine configuration and output data and write to port
outp(BA+3,out_data || conf_data); // write to correct address
This code can be compressed into more elegant and optimum code. The steps above
illustrate the logic of operation.
Trigger output programming
As described in the previous sections an external trigger may be used to indicate
to the host or other devices that a predetermined input condition has occurred. Before you can
use an external trigger you must first program your DM6854HR to enable correct operation.
The following steps must be taken.
1.
Program the mask and inversion register first here ....
2.
Now we must program the polarity of the trigger output to other devices
if this function is used
3.
Clear interrupt and trigger register
4.
Enable trigger output tristate buffer
5.
Enable interrupts, this also enables the operation of the external trigger output
DM5854HR/DM6854HR Page 35 (c) RTD Finland Oy 1996-2001