background image

Chapter 3

Programming

©

National Instruments Corporation

3-7

6527 Register-Level Programmer Manual

Change Notification

This section describes how to configure the change notification interrupt feature, handle
interrupts using the 6527 device registers, and unconfigure the change notification interrupt
feature.

As mentioned at the beginning of this manual, you need to know how to write, install, and
uninstall interrupt service routines to use change notification with register-level
programming. This manual does not cover interrupt service routines.

Configuring Interrupt Generation

This example generates an interrupt if certain lines of Input Port 0 change. As illustrated in
Table 3-1, a fall on line 0, a rise on line 1, or any change on line 7, 6, 5, or 4 generates an
interrupt.

Tip

It is recommended that you enable input filtering to prevent a brief glitch or noise

pulse from generating a false interrupt. Filtering also helps protect your computer from an
excessive interrupt rate in case of rapidly changing inputs. This example includes input
filtering.

Follow these steps to configure interrupt generation:

1.

Enable input filtering (optional, but recommended).

Set up filtering with interval of 10 ms.

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

Table 3-1.

Change Notification Example

Bit

7

6

5

4

3

2

1

0

Changes to detect

Enable rising-edge
detection

yes

yes

yes

yes

no

no

yes

no

Enable falling-edge
detection

yes

yes

yes

yes

no

no

no

yes

Summary of Contents for 6527

Page 1: ...DAQ 6527 Register Level Programmer Manual 6527 Register Level Programmer Manual September 2001 Edition Part Number 370106B 01...

Page 2: ...09 725 725 11 France 01 48 14 24 24 Germany 089 741 31 30 Greece 30 1 42 96 427 Hong Kong 2645 3186 India 91805275406 Israel 03 6120092 Italy 02 413091 Japan 03 5472 2970 Korea 02 596 7456 Malaysia 60...

Page 3: ...ailures caused by owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts and p...

Page 4: ...sters Ports 0 2 2 3 Output Registers Ports 3 5 2 4 ID Register 2 5 Clear Register 2 6 Filter Interval Registers 2 7 Filter Enables Ports 0 2 2 8 Change Status Register 2 9 Master Interrupt Control Reg...

Page 5: ...egister Level Programmer Manual vi ni com Change Notification 3 7 Configuring Interrupt Generation 3 7 Handling Interrupts 3 8 Disabling Change Notification 3 8 Appendix A Technical Support Resources...

Page 6: ...anual Note National Instruments strongly recommends using application development environment software such as LabVIEW Measurement Studio or NI DAQ to program your 6527 device Application software pro...

Page 7: ...ons to take to avoid injury data loss or a system crash bold Bold text denotes items that you must select or click on in the software such as menu items and dialog box options Bold text also denotes p...

Page 8: ...es to notify you of changing data For more information regarding the functions installation connections and safe use of the 6527 refer to the 6527 User Manual Caution Using your 6527 device in a way i...

Page 9: ...input lines using digital filtering Filtering can help eliminate glitches on input data and reduces the number of changes you need to process if you are using digital filtering with change notificatio...

Page 10: ...on of each register follows the table Table 2 1 6527 Register Address Map Register Name Offset Hex Type Size General Operation Registers Port 0 Register Port 1 Register Port 2 Register Port 3 Register...

Page 11: ...inside Change Notification Registers Change Status Master Interrupt Control Port 0 Rising Edge Detection Enable Port 1 Rising Edge Detection Enable Port 2 Rising Edge Detection Enable Port 0 Falling E...

Page 12: ...ptically isolated digital input lines on the corresponding port Address Offsets 00 hex for Port 0 01 hex for Port 1 02 hex for Port 2 Type Read only Size 8 bit Bit Map Bit Name Description 7 0 N 7 0 D...

Page 13: ...gister to get the states of the eight relays associated with the port The power up state of each register is all high hex FF causing the relays to be open Address Offset 03 hex for Port 3 04 hex for P...

Page 14: ...ID Register is read only Use this register to confirm that you are successfully reading from your device Reading this register returns the hexadecimal value 27 Address Offset 06 hex Type Read only Si...

Page 15: ...to these bits 3 ClrEdge Clear Edge Detectors Set this bit to 1 to clear the EdgeStatus status bit in the Change Status Register and clear all edge detectors 2 ClrOverflow Clear Overflow Set this bit...

Page 16: ...r interval write to the ClrInterval bit of the Clear Register to ensure that the new filter interval takes effect immediately The filter interval affects only those input lines for which you have set...

Page 17: ...You can enable or disable filtering individually for each input line Address Offsets 0C hex for Port 0 0D hex for Port 1 0E hex for Port 2 Type Read and write Size 8 bit Bit Map Bit Name Description...

Page 18: ...its are undefined and should be ignored 2 MasterInterruptStatus Indicates that the device is asserting an interrupt 1 Overflow Indicates that at least one more edge has been detected since an interrup...

Page 19: ...nly zeroes to these bits 4 FallingEdgeIntEnable Interrupt Enable control Enable interrupt on falling edge detection This is enabled upon power up 1 Interrupt enabled 0 Interrupt disabled 3 RisingEdgeI...

Page 20: ...2 11 6527 Register Level Programmer Manual 1 OverflowIntEnable Interrupt Enable control Enable overflow interrupt 1 Interrupt enabled 0 Interrupt disabled 0 EdgeIntEnable Edge Interrupt Enable control...

Page 21: ...also set the EdgeInt bit in the Master Interrupt Control Register Address Offsets 18 hex for Port 0 19 hex for Port 1 1A hex for Port 2 Type Read and write Size 8 bit Bit Map Bit Name Description 7 0...

Page 22: ...pts you must also set the EdgeInt bit in the Master Interrupt Control Register Address Offsets 20 hex for Port 0 21 hex for Port 1 22 hex for Port 2 Type Read and write Size 8 bit Bit Map Bit Name Des...

Page 23: ...reading from registers on the device Registers are listed in Chapter 2 Register Map and Descriptions Note In this chapter all numbers preceded by 0x are hexadecimal Common Terms The following list of...

Page 24: ...us with multiplexed address and data lines This system arbitrates and assigns resources through software freeing you from manually setting switches and jumpers The 6527 devices are fully compatible wi...

Page 25: ...u choose not to re map the device you can skip the first CWrite instruction but you still need to perform the next and last instructions to initialize the device All values in this example are 32 bits...

Page 26: ...osh Memory Inside Macintosh Operating System Utilities Inside Macintosh Processes Inside Macintosh Power PC System Software Example Use the following code sequence to activate the device Using the doc...

Page 27: ...For input and output specifications refer to Appendix A Specifications of your 6527 User Manual Handshaking is also not required simply write to or read from a specified port Input You can read your...

Page 28: ...Filter Interval 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...

Page 29: ...on line 1 or any change on line 7 6 5 or 4 generates an interrupt Tip It is recommended that you enable input filtering to prevent a brief glitch or noise pulse from generating a false interrupt Filt...

Page 30: ...R use the Change Status Register to verify that a change occurred using the following pseudocode example Read Change Status Read status to verify change occurred Then read the value of the input lines...

Page 31: ...access the latest example programs system configurators tutorials technical news as well as a community of developers ready to share their own techniques Customer Education National Instruments provid...

Page 32: ...ce Web sites from the Worldwide Offices section of ni com Branch office Web sites provide up to date contact information support phone numbers e mail addresses and current events If you have searched...

Page 33: ...oprietary semiconductor component designed and manufactured to perform a set of specific functions for a specific application C CompactPCI refers to the core specification defined by the PCI Industria...

Page 34: ...y to eliminate high potential differences and transients optocoupler a device that transfers electrical signals by utilizing light waves to provide coupling with electrical isolation between input and...

Page 35: ...lter bit Clear Register 2 6 ClrInterval bit Clear Register 2 6 ClrOverflow bit Clear Register 2 6 configuring interrupt generation 3 7 to 3 8 conventions used in manual viii customer education A 1 D d...

Page 36: ...ster Interrupt Control Register 2 10 MasterInterruptStatus bit Change Status Register 2 9 N N 7 0 bits Input Registers Ports 0 2 2 3 Output Registers Ports 3 5 2 4 NI Developer Zone A 1 O output progr...

Page 37: ...0 2 2 12 digital filtering registers Filter Enables Ports 0 2 2 8 Filter Interval Registers 2 7 register address map table 2 1 general operation registers 1 2 Clear Register 2 6 ID Register 2 5 Input...

Reviews: