![National Instruments 6527 Скачать руководство пользователя страница 28](http://html2.mh-extra.com/html/national-instruments/6527/6527_programmers-manual_3433890028.webp)
Chapter 3
Programming
6527 Register-Level Programmer Manual
3-6
ni.com
Input with Filtering
You have the option to set filter enable bits and a filter period before performing input.
The following example enables filtering with an interval of 10 ms for Port 0 (all lines).
To use filtering, set the filter enable bits for the lines you want to filter. Then set a filter
interval, which is common to all lines. The filter interval is in 200 ns increments. To set
a filter interval of 10 ms, the value to write to the Filter Interval Register is 0x00C350
((10 ms/200 ns) = 50,000 decimal = 0x00C350 hexadecimal).
Use the following pseudocode example:
Write (Filter In 2, 0x00)
//Set most significant bits of filter interval
Write (Filter In 1, 0xC3)
//Set the intermediate bits of filter interval
Write (Filter In 0, 0x50)
//Set least significant bits of filter interval
Write (Clear Register, 0x03)
//Clear filters and filter interval clock
Write (Port 0 Filter Enables, 0xFF)
//Enable filtering for all eight bits of Port 0
Read (Port 0)
//Begin reading filtered input
Output
To control an output port of a 6527 device, write a digital value to the appropriate Port
Register to control the solid-state relays associated with that port. At power-up, all solid-state
relays of all output ports are open.
Note
Writing a digital 1 to a port line (which is also the initial power-up state) opens the
relay. Writing a digital 0 to a port line closes the relay, allowing current to flow between
the DIG+ and DIG– terminals of the switch.
The following example writes eight bits—11111110 binary, or 0xFE hexadecimal—to Port 0.
This value closes the solid-state relay on Port 0, line 0, but leaves all other relays in the port
open.
Use the following pseudocode example:
Write (Port 0, 0xFE)
//Write 11111110 binary to Port 0