logo资料库

NI-8451数据采集.pdf

第1页 / 共524页
第2页 / 共524页
第3页 / 共524页
第4页 / 共524页
第5页 / 共524页
第6页 / 共524页
第7页 / 共524页
第8页 / 共524页
资料共524页,剩余部分请下载后查看
NI-845x Hardware and Software Manual
Support
Worldwide Technical Support and Product Information
Worldwide Offices
National Instruments Corporate Headquarters
Important Information
Warranty
Copyright
End-User License Agreements and Third-Party Legal Notices
Trademarks
Patents
Export Compliance Information
WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS
Compliance
Contents
About This Manual
Conventions
Chapter 1 Introduction
I2C Bus
I2C Terminology
I2C Bus
I2C Arbitration
I2C Transfers
Figure 1-1. I2C Transfers
I2C ACK Polling
I2C Clock Stretching
I2C Extended (10-Bit) Addressing
I2C High Speed Master Code
I2C vs. SMBus
SPI Bus
SPI Terminology
SPI Bus
Clock and Polarity
Table 1-1. SPI Modes
Figure 1-2. SPI Polarity Phase Differences
Error Handling
Chapter 2 Installation
Software Installation
Hardware Installation
System Configuration API
Chapter 3 NI USB-845x Hardware Overview
Overview
NI USB-8451
Overview
Block Diagram
Figure 3-1. NI USB-8451 Block Diagram
Installing Software
Setting Up Hardware
NI USB-8451
Figure 3-2. Signal Label Application Diagram
NI USB-8451 OEM
I/O Connector and Cable
NI USB-8451
Table 3-1. Digital Terminal Assignments
NI USB-8451 OEM
Table 3-2. Pin Assignments
Signal Descriptions
Table 3-3. Signal Descriptions
Front-End I/O Interfaces
Digital I/O (DIO)
Figure 3-3. Example of Connecting External User-Provided Resistor
Figure 3-4. Example of Connecting a Load
SPI Interface
Figure 3-5. SPI Interface to Three Peripherals
I2C Interface
Figure 3-6. I2C Interface to Two Peripherals
I/O Protection
Power-On States
+5 V Power Source
NI USB-8452
Overview
Figure 3-7. NI USB-8452 with Enclosure
Block Diagram
Figure 3-8. NI USB-8452 Block Diagram
Installing Software
Setting Up Hardware
Figure 3-9. IDE-40 Connector Pin Assignments
Signal Descriptions
Table 3-4. Signal Descriptions
Front-End I/O Interfaces
SPI Interface
Figure 3-10. SPI Interface to Three Peripherals
I2C Interface
Figure 3-11. I2C Interface to Two Peripherals
Digital I/O (DIO)
LED Indicators
Figure 3-12. LED Indicators on NI USB-8452
Figure 3-13. LED Indicators on NI USB-8452 OEM
I/O Protection
Power-On States
Power Sources
+5 V Power Source
Vref I/O Reference Voltage
Chapter 4 Using the NI-845x API
Chapter 5 Using the NI-845x I2C API
I2C Basic Programming Model
Figure 5-1. Basic Programming Model for I2C Communication
I2C Configure
I2C Write
I2C Read
I2C Write Read
I2C Scripting Programming Model
Figure 5-2. Example of Scripting Programming Model with Scripting API for I2C Communication
Script: Set I2C Clock Rate
Script: Set I2C ACK Poll Timeout
Script: Pullup Enable
Script: Set I2C High Speed Clock Rate
Script: Set I2C High Speed Enable
Script: Issue Start Condition
Script: Send High Speed Master Code
Script: Send Address + Read
Script: Read
Script: Send Address + Write
Script: Write
Script: Issue Stop Condition
Run Script
Extract Read Data
Chapter 6 NI-845x I2C API for LabVIEW
General Device
NI-845x Close Reference.vi
NI-845x Device Property Node
NI-845x Device Reference
Configuration
NI-845x I2C Configuration Property Node
NI-845x I2C Create Configuration Reference.vi
Basic
NI-845x I2C Read.vi
NI-845x I2C Write.vi
NI-845x I2C Write Read.vi
Scripting
NI-845x I2C Create Script Reference.vi
NI-845x I2C Extract Script Read Data.vi
NI-845x I2C Run Script.vi
NI-845x I2C Script ACK Poll Timeout.vi
NI-845x I2C Script Address+Read.vi
NI-845x I2C Script Address+Write.vi
NI-845x I2C Script Clock Rate.vi
NI-845x I2C Script Delay (Microsecond).vi
NI-845x I2C Script Delay (Millisecond).vi
NI-845x I2C Script DIO Configure Line.vi
NI-845x I2C Script DIO Configure Port.vi
NI-845x I2C Script DIO Read Line.vi
NI-845x I2C Script DIO Read Port.vi
NI-845x I2C Script DIO Write Line.vi
NI-845x I2C Script DIO Write Port.vi
NI-845x I2C Script Pullup Enable.vi
NI-845x I2C Script HS Enable.vi
NI-845x I2C Script HS Master Code.vi
NI-845x I2C Script HS Clock Rate.vi
NI-845x I2C Script Issue Start.vi
NI-845x I2C Script Issue Stop.vi
NI-845x I2C Script Read.vi
NI-845x I2C Script Write.vi
Chapter 7 NI-845x I2C API for C
Section Headings
Purpose
Format
Inputs and Outputs
Description
Data Types
List of Functions
General Device
ni845xClose
ni845xCloseFindDeviceHandle
ni845xDeviceLock
ni845xDeviceUnlock
ni845xFindDevice
ni845xFindDeviceNext
ni845xOpen
ni845xSetIoVoltageLevel
ni845xI2cSetPullupEnable
ni845xStatusToString
ni845xSetTimeout
Configuration
ni845xI2cConfigurationClose
ni845xI2cConfigurationGetAckPollTimeout
ni845xI2cConfigurationGetAddress
ni845xI2cConfigurationGetAddressSize
ni845xI2cConfigurationGetClockRate
ni845xI2cConfigurationGetHSClockRate
ni845xI2cConfigurationGetHSEnable
ni845xI2cConfigurationGetHSMasterCode
ni845xI2cConfigurationGetPort
ni845xI2cConfigurationOpen
ni845xI2cConfigurationSetAckPollTimeout
ni845xI2cConfigurationSetAddress
ni845xI2cConfigurationSetAddressSize
ni845xI2cConfigurationSetClockRate
ni845xI2cConfigurationSetHSClockRate
ni845xI2cConfigurationSetHSEnable
ni845xI2cConfigurationSetHSMasterCode
ni845xI2cConfigurationSetPort
Basic
ni845xI2cRead
ni845xI2cWrite
ni845xI2cWriteRead
Scripting
ni845xI2cScriptAckPollTimeout
ni845xI2cScriptAddressRead
ni845xI2cScriptAddressWrite
ni845xI2cScriptClockRate
ni845xI2cScriptClose
ni845xI2cScriptDelay
ni845xI2cScriptDioConfigureLine
ni845xI2cScriptDioConfigurePort
ni845xI2cScriptDioReadLine
ni845xI2cScriptDioReadPort
ni845xI2cScriptDioWriteLine
ni845xI2cScriptDioWritePort
ni845xI2cScriptPullupEnable
ni845xI2cScriptExtractReadData
ni845xI2cScriptExtractReadDataSize
ni845xI2cScriptHSEnable
ni845xI2cScriptHSMasterCode
ni845xI2cScriptHSClockRate
ni845xI2cScriptIssueStart
ni845xI2cScriptIssueStop
ni845xI2cScriptOpen
ni845xI2cScriptRead
ni845xI2cScriptReset
ni845xI2cScriptRun
ni845xI2cScriptUsDelay
ni845xI2cScriptWrite
Chapter 8 Using the NI-845x I2C Slave API
I2C Slave Programming Model
Figure 8-1. Programming Model for I2C Slave Communication
I2C Slave Configure
I2C Slave Start
I2C Slave Wait For Event
I2C Slave Read
I2C Slave Write
I2C Slave Get Write Information
I2C Slave Stop
Chapter 9 NI-845x I2C Slave API for LabVIEW
General Device
NI-845x Close Reference.vi
NI-845x Device Property Node
NI-845x Device Reference
Configuration
NI-845x I2C Slave Configuration Property Node
NI-845x I2C Slave Create Configuration Reference.vi
NI-845x I2C Slave Get Write Info.vi
NI-845x I2C Slave Read.vi
NI-845x I2C Slave Start.vi
NI-845x I2C Slave Stop.vi
NI-845x I2C Slave Wait for Event.vi
NI-845x I2C Slave Write.vi
Chapter 10 NI-845x I2C Slave API for C
Section Headings
Purpose
Format
Inputs and Outputs
Description
Data Types
List of Functions
General Device
ni845xClose
ni845xCloseFindDeviceHandle
ni845xDeviceLock
ni845xDeviceUnlock
ni845xFindDevice
ni845xFindDeviceNext
ni845xOpen
ni845xSetIoVoltageLevel
ni845xI2cSetPullupEnable
ni845xSetTimeout
ni845xStatusToString
Configuration
ni845xI2cSlaveConfigurationClose
ni845xI2cSlaveConfigurationGetAddress
ni845xI2cSlaveConfigurationGetAutoRemovalTimeout
ni845xI2cSlaveConfigurationGetCommandBufferSize
ni845xI2cSlaveConfigurationGetDataBufferSize
ni845xI2cSlaveConfigurationOpen
ni845xI2cSlaveConfigurationSetAddress
ni845xI2cSlaveConfigurationSetAutoRemovalTimeout
ni845xI2cSlaveConfigurationSetCommandBufferSize
ni845xI2cSlaveConfigurationSetDataBufferSize
Slave
ni845xI2cSlaveGetWriteInfo
ni845xI2cSlaveRead
ni845xI2cSlaveStart
ni845xI2cSlaveStop
ni845xI2cSlaveWaitForEvent
ni845xI2cSlaveWrite
Chapter 11 Using the NI-845x SPI API
NI-845x SPI Basic Programming Model
Figure 11-1. NI-845x SPI API Basic Programming Model
SPI Configure
SPI Write Read
SPI Timing Characteristics
Figure 11-2. SPI Waveform
Table 11-1. NI USB-8451 Basic API SPI Timing Characteristics
Table 11-2. NI USB-8452 Basic API SPI Timing Characteristics
NI-845x SPI Scripting Programming Model
Figure 11-3. Scripting Functions Programming Example
Script: Enable SPI
Script: Configure Phase, Polarity, Clock Rate, Number of Bits
Script: Chip Select Low
Script: Write Read
Script: Chip Select High
Script: Disable SPI
Run Script
Extract Read Data
Chapter 12 NI-845x SPI API for LabVIEW
General Device
NI-845x Close Reference.vi
NI-845x Device Property Node
NI-845x Device Reference
Configuration
NI-845x SPI Configuration Property Node
NI-845x SPI Create Configuration Reference.vi
Basic
NI-845x SPI Write Read.vi
Scripting
NI-845x SPI Create Script Reference.vi
NI-845x SPI Extract Script Read Data.vi
NI-845x SPI Run Script.vi
NI-845x SPI Script Clock Polarity Phase.vi
NI-845x SPI Script Clock Rate.vi
NI-845x SPI Script CS High.vi
NI-845x SPI Script CS Low.vi
NI-845x SPI Script Delay (Microsecond).vi
NI-845x SPI Script Delay (Millisecond).vi
NI-845x SPI Script DIO Configure Line.vi
NI-845x SPI Script DIO Configure Port.vi
NI-845x SPI Script DIO Read Line.vi
NI-845x SPI Script DIO Read Port.vi
NI-845x SPI Script DIO Write Line.vi
NI-845x SPI Script DIO Write Port.vi
NI-845x SPI Script Disable SPI.vi
NI-845x SPI Script Enable SPI.vi
NI-845x SPI Script Num Bits Per Sample.vi
NI-845x SPI Script Write Read.vi
Chapter 13 NI-845x SPI API for C
Section Headings
Purpose
Format
Inputs and Outputs
Description
Data Types
List of Functions
General Device
ni845xClose
ni845xCloseFindDeviceHandle
ni845xDeviceLock
ni845xDeviceUnlock
ni845xFindDevice
ni845xFindDeviceNext
ni845xOpen
ni845xSetIoVoltageLevel
ni845xSetTimeout
ni845xStatusToString
Configuration
ni845xSpiConfigurationClose
ni845xSpiConfigurationGetChipSelect
ni845xSpiConfigurationGetClockPhase
ni845xSpiConfigurationGetClockPolarity
ni845xSpiConfigurationGetClockRate
ni845xSpiConfigurationGetNumBitsPerSample
ni845xSpiConfigurationGetPort
ni845xSpiConfigurationOpen
ni845xSpiConfigurationSetChipSelect
ni845xSpiConfigurationSetClockPhase
ni845xSpiConfigurationSetClockPolarity
ni845xSpiConfigurationSetClockRate
ni845xSpiConfigurationSetNumBitsPerSample
ni845xSpiConfigurationSetPort
Basic
ni845xSpiWriteRead
Scripting
ni845xSpiScriptClockPolarityPhase
ni845xSpiScriptClockRate
ni845xSpiScriptClose
ni845xSpiScriptCSHigh
ni845xSpiScriptCSLow
ni845xSpiScriptDelay
ni845xSpiScriptDioConfigureLine
ni845xSpiScriptDioConfigurePort
ni845xSpiScriptDioReadLine
ni845xSpiScriptDioReadPort
ni845xSpiScriptDioWriteLine
ni845xSpiScriptDioWritePort
ni845xSpiScriptDisableSPI
ni845xSpiScriptEnableSPI
ni845xSpiScriptExtractReadData
ni845xSpiScriptExtractReadDataSize
ni845xSpiScriptNumBitsPerSample
ni845xSpiScriptOpen
ni845xSpiScriptReset
ni845xSpiScriptRun
ni845xSpiScriptUsDelay
ni845xSpiScriptWriteRead
Chapter 14 Using the NI-845x SPI Stream API
NI-845x SPI Stream Programming Model
Figure 14-1. NI-845x SPI API Stream Programming Model
SPI Stream Configure
SPI Stream Start
SPI Stream Read
SPI Stream Stop
Waveform 1
Figure 14-2. Waveform 1 Timing Diagram
Table 14-1. Timing Parameters
Extra SPI Pin Descriptions
CONV
DRDY
Chip Select
Chapter 15 NI-845x SPI Stream API for LabVIEW
General Device
NI-845x Close Reference.vi
NI-845x Device Property Node
NI-845x Device Reference
Configuration
NI-845x SPI Stream Configuration Property Node
NI-845x SPI Stream Create Configuration Reference.vi
Streaming
NI-845x SPI Stream Read.vi
NI-845x SPI Stream Start.vi
NI-845x SPI Stream Stop.vi
Chapter 16 NI-845x SPI Stream API for C
Section Headings
Purpose
Format
Inputs and Outputs
Description
Data Types
List of Functions
General Device
ni845xClose
ni845xCloseFindDeviceHandle
ni845xDeviceLock
ni845xDeviceUnlock
ni845xFindDevice
ni845xFindDeviceNext
ni845xOpen
ni845xSetTimeout
ni845xStatusToString
Configuration
ni845xSpiStreamConfigurationClose
ni845xSpiStreamConfigurationOpen
ni845xSpiStreamConfigurationGetNumBits
ni845xSpiStreamConfigurationGetNumSamples
ni845xSpiStreamConfigurationGetPacketSize
ni845xSpiStreamConfigurationGetClockPhase
ni845xSpiStreamConfigurationWave1GetPinConfig
ni845xSpiStreamConfigurationGetClockPolarity
ni845xSpiStreamConfigurationWave1GetTimingParam
ni845xSpiStreamConfigurationWave1SetMosiData
ni845xSpiStreamConfigurationSetNumBits
ni845xSpiStreamConfigurationSetNumSamples
ni845xSpiStreamConfigurationSetPacketSize
ni845xSpiStreamConfigurationSetClockPhase
ni845xSpiStreamConfigurationWave1SetPinConfig
ni845xSpiStreamConfigurationSetClockPolarity
ni845xSpiStreamConfigurationWave1SetTimingParam
Streaming
ni845xSpiStreamRead
ni845xSpiStreamStart
ni845xSpiStreamStop
Chapter 17 Using the NI-845x DIO API
NI-845x DIO Basic Programming Model
Figure 17-1. Basic Programming Model for DIO Communication
DIO Port Configure
DIO Port Write
DIO Port Read
DIO Line Write
DIO Line Read
Chapter 18 NI-845x DIO API for LabVIEW
General Device
NI-845x Close Reference.vi
NI-845x Device Property Node
NI-845x Device Reference
Basic
NI-845x DIO Read Line.vi
NI-845x DIO Read Port.vi
NI-845x DIO Write Line.vi
NI-845x DIO Write Port.vi
Chapter 19 NI-845x DIO API for C
Section Headings
Purpose
Format
Inputs and Outputs
Description
Data Types
List of Functions
General Device
ni845xClose
ni845xCloseFindDeviceHandle
ni845xDeviceLock
ni845xDeviceUnlock
ni845xFindDevice
ni845xFindDeviceNext
ni845xOpen
ni845xSetIoVoltageLevel
ni845xSetTimeout
ni845xStatusToString
Basic
ni845xDioReadLine
ni845xDioReadPort
ni845xDioSetPortLineDirectionMap
ni845xDioSetDriverType
ni845xDioWriteLine
ni845xDioWritePort
Appendix A NI USB-845x Hardware Specifications
NI USB-8451
Digital I/O (DIO)
SPI Interface
I2C Interface
Bus Interface
Power Requirements
Output Voltage Sources
Physical Characteristics
NI USB-8451
NI USB-8451 OEM
Figure A-1. USB-8451 OEM Dimensions (Top View)
Figure A-2. USB-8451 OEM Dimensions (Front and Rear Views)
Overvoltage Protection
NI USB-8452
Digital I/O(DIO)
SPI Interface
I2C Interface
Bus Interface
Power Requirements
Output Voltage Sources
Physical Characteristics
NI USB-8452
NI USB-8452 OEM
Figure A-3. USB-8452 OEM Dimensions (Top View)
Figure A-4. USB-8452 OEM Dimensions (Front and Rear Views)
Safety
Safety Standards
Hazardous Locations
Electromagnetic Compatibility
NI USB-8451
NI USB-8452
NI USB-8451 OEM, NI USB-8452 OEM
CE Compliance
NI USB-8451
NI USB-8452
NI USB-8451 OEM, NI USB-8452 OEM
Online Product Certification
Environmental
Environmental Management
Waste Electrical and Electronic Equipment (WEEE)
Appendix B Technical Support and Professional Services
Glossary
A-C
I-S
T
Index
Symbols
A-C
D-H
I-L
N
O-S
T-W
I C/SPI 2 NI-845x Hardware and Software Manual NI-845x Hardware and Software Manual August 2012 371746D-01
Support Worldwide Technical Support and Product Information ni.com Worldwide Offices Visit ni.com/niglobal to access the branch office Web sites, which provide up-to-date contact information, support phone numbers, email addresses, and current events. National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100 For further support information, refer to the Technical Support and Professional Services appendix. To comment on National Instruments documentation, refer to the National Instruments Web site at ni.com/info and enter the Info Code feedback. © 2005–2012 National Instruments. All rights reserved.
Important Information Warranty The USB-845x hardware is warranted against defects in materials and workmanship for a period of one year from the date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace equipment that proves to be defective during the warranty period. This warranty includes parts and labor. The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free. A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty. National Instruments believes that the information in this document is accurate. The document has been carefully reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it. EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. CUSTOMER’S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages, defects, malfunctions, or service failures 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 power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control. Copyright Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation. National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction. End-User License Agreements and Third-Party Legal Notices You can find end-user license agreements (EULAs) and third-party legal notices in the following locations: Notices are located in the \_Legal Information and directories. EULAs are located in the \Shared\MDF\Legal\license directory. Review \_Legal Information.txt for more information on including legal information in installers built with NI products. Trademarks LabVIEW, National Instruments, NI, ni.com, the National Instruments corporate logo, and the Eagle logo are trademarks of National Instruments Corporation. Refer to the Trademark Information at ni.com/trademarks for other National Instruments trademarks. Other product and company names mentioned herein are trademarks or trade names of their respective companies. Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency, partnership, or joint-venture relationship with National Instruments. Patents For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents. Export Compliance Information Refer to the Export Compliance Information at ni.com/legal/export-compliance for the National Instruments global trade compliance policy and how to obtain relevant HTS codes, ECCNs, and other import/export data. WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS (1) NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTING FOR A LEVEL OF RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT INJURY TO A HUMAN. (2) IN ANY APPLICATION, INCLUDING THE ABOVE, RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS CAN BE IMPAIRED BY ADVERSE FACTORS, INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY, COMPUTER HARDWARE MALFUNCTIONS, COMPUTER OPERATING SYSTEM SOFTWARE FITNESS, FITNESS OF COMPILERS AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION, INSTALLATION ERRORS, SOFTWARE AND HARDWARE COMPATIBILITY PROBLEMS, MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL DEVICES, TRANSIENT FAILURES OF ELECTRONIC SYSTEMS (HARDWARE AND/OR SOFTWARE), UNANTICIPATED USES OR MISUSES, OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER (ADVERSE FACTORS SUCH AS THESE ARE HEREAFTER COLLECTIVELY TERMED “SYSTEM FAILURES”). ANY APPLICATION WHERE A SYSTEM FAILURE WOULD CREATE A RISK OF HARM TO PROPERTY OR PERSONS (INCLUDING THE RISK OF BODILY INJURY AND DEATH) SHOULD NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE. TO AVOID DAMAGE, INJURY, OR DEATH,
THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES, INCLUDING BUT NOT LIMITED TO BACK-UP OR SHUT DOWN MECHANISMS. BECAUSE EACH END-USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL INSTRUMENTS' TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL INSTRUMENTS, THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION, INCLUDING, WITHOUT LIMITATION, THE APPROPRIATE DESIGN, PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION.
Compliance Electromagnetic Compatibility Information This hardware has been tested and found to comply with the applicable regulatory requirements and limits for electromagnetic compatibility (EMC) as indicated in the hardware’s Declaration of Conformity (DoC)1. These requirements and limits are designed to provide reasonable protection against harmful interference when the hardware is operated in the intended electromagnetic environment. In special cases, for example when either highly sensitive or noisy hardware is being used in close proximity, additional mitigation measures may have to be employed to minimize the potential for electromagnetic interference. While this hardware is compliant with the applicable regulatory EMC requirements, there is no guarantee that interference will not occur in a particular installation. To minimize the potential for the hardware to cause interference to radio and television reception or to experience unacceptable performance degradation, install and use this hardware in strict accordance with the instructions in the hardware documentation and the DoC1. If this hardware does cause interference with licensed radio communications services or other nearby electronics, which can be determined by turning the hardware off and on, you are encouraged to try to correct the interference by one or more of the following measures: Some hardware may require the use of a metal, shielded enclosure (windowless version) to meet the EMC requirements for special EMC environments such as, for marine use or in heavy industrial areas. Refer to the hardware’s user documentation and the DoC1 for product installation requirements. When the hardware is connected to a test object or to test leads, the system may become more sensitive to disturbances or may cause interference in the local electromagnetic environment. Operation of this hardware in a residential area is likely to cause harmful interference. Users are required to correct the interference at their own expense or cease operation of the hardware. Changes or modifications not expressly approved by National Instruments could void the user’s right to operate the hardware under the local regulatory rules. Reorient the antenna of the receiver (the device suffering interference). Relocate the transmitter (the device generating interference) with respect to the receiver. Plug the transmitter into a different outlet so that the transmitter and the receiver are on different branch circuits. 1 The Declaration of Conformity (DoC) contains important EMC compliance information and instructions for the user or installer. To obtain the DoC for this product, visit ni.com/certification, search by model number or product line, and click the appropriate link in the Certification column.
Contents About This Manual Conventions ...................................................................................................................xxi Chapter 1 Introduction I2C Bus...........................................................................................................................1-1 I2C Terminology..............................................................................................1-1 I2C Bus ............................................................................................................1-2 I2C Arbitration.................................................................................................1-2 I2C Transfers....................................................................................................1-3 I2C ACK Polling..............................................................................................1-4 I2C Clock Stretching........................................................................................1-4 I2C Extended (10-Bit) Addressing ..................................................................1-4 I2C High Speed Master Code ..........................................................................1-5 I2C vs. SMBus .................................................................................................1-5 SPI Bus ..........................................................................................................................1-6 SPI Terminology .............................................................................................1-6 SPI Bus ............................................................................................................1-7 Clock and Polarity ...........................................................................................1-7 Error Handling.................................................................................................1-8 Chapter 2 Installation Software Installation ......................................................................................................2-1 Hardware Installation.....................................................................................................2-1 System Configuration API.............................................................................................2-3 Chapter 3 NI USB-845x Hardware Overview Overview........................................................................................................................3-1 NI USB-8451 .................................................................................................................3-1 Overview .........................................................................................................3-1 Block Diagram.................................................................................................3-2 Installing Software...........................................................................................3-2 Setting Up Hardware .......................................................................................3-2 NI USB-8451 ....................................................................................3-2 NI USB-8451 OEM ..........................................................................3-3 © National Instruments vii NI-845x Hardware and Software Manual
Contents I/O Connector and Cable................................................................................. 3-4 NI USB-8451.................................................................................... 3-4 NI USB-8451 OEM .......................................................................... 3-5 Signal Descriptions ......................................................................................... 3-6 Front-End I/O Interfaces ................................................................................. 3-7 Digital I/O (DIO) .............................................................................. 3-7 SPI Interface ..................................................................................... 3-9 I2C Interface...................................................................................... 3-10 I/O Protection.................................................................................................. 3-10 Power-On States.............................................................................................. 3-11 +5 V Power Source ......................................................................................... 3-11 NI USB-8452................................................................................................................. 3-11 Overview......................................................................................................... 3-11 Block Diagram ................................................................................................ 3-12 Installing Software .......................................................................................... 3-13 Setting Up Hardware....................................................................................... 3-13 Signal Descriptions ......................................................................................... 3-14 Front-End I/O Interfaces ................................................................................. 3-16 SPI Interface ..................................................................................... 3-16 I2C Interface...................................................................................... 3-18 Digital I/O (DIO) .............................................................................. 3-19 LED Indicators................................................................................................ 3-20 I/O Protection.................................................................................................. 3-21 Power-On States.............................................................................................. 3-21 Power Sources................................................................................................. 3-21 +5 V Power Source........................................................................... 3-21 Vref I/O Reference Voltage.............................................................. 3-22 Chapter 4 Using the NI-845x API Chapter 5 Using the NI-845x I2C API I2C Basic Programming Model ..................................................................................... 5-1 I2C Configure .................................................................................................. 5-2 I2C Write ......................................................................................................... 5-2 I2C Read .......................................................................................................... 5-2 I2C Write Read ................................................................................................ 5-2 I2C Scripting Programming Model................................................................................ 5-2 Script: Set I2C Clock Rate............................................................................... 5-4 Script: Set I2C ACK Poll Timeout .................................................................. 5-4 Script: Pullup Enable ...................................................................................... 5-4 NI-845x Hardware and Software Manual viii ni.com
Contents Script: Set I2C High Speed Clock Rate...........................................................5-4 Script: Set I2C High Speed Enable .................................................................5-4 Script: Issue Start Condition............................................................................5-5 Script: Send High Speed Master Code ............................................................5-5 Script: Send Address + Read...........................................................................5-5 Script: Read .....................................................................................................5-5 Script: Send Address + Write..........................................................................5-5 Script: Write ....................................................................................................5-6 Script: Issue Stop Condition............................................................................5-6 Run Script........................................................................................................5-6 Extract Read Data............................................................................................5-6 Chapter 6 NI-845x I2C API for LabVIEW General Device ..............................................................................................................6-2 NI-845x Close Reference.vi ............................................................................6-2 NI-845x Device Property Node.......................................................................6-4 NI-845x Device Reference ..............................................................................6-7 Configuration .................................................................................................................6-8 NI-845x I2C Configuration Property Node.....................................................6-8 NI-845x I2C Create Configuration Reference.vi ............................................6-12 Basic...............................................................................................................................6-14 NI-845x I2C Read.vi .......................................................................................6-14 NI-845x I2C Write.vi ......................................................................................6-16 NI-845x I2C Write Read.vi .............................................................................6-18 Scripting.........................................................................................................................6-20 NI-845x I2C Create Script Reference.vi .........................................................6-20 NI-845x I2C Extract Script Read Data.vi........................................................6-22 NI-845x I2C Run Script.vi ..............................................................................6-24 NI-845x I2C Script ACK Poll Timeout.vi ......................................................6-26 NI-845x I2C Script Address+Read.vi .............................................................6-28 NI-845x I2C Script Address+Write.vi ............................................................6-30 NI-845x I2C Script Clock Rate.vi ...................................................................6-32 NI-845x I2C Script Delay (Microsecond).vi...................................................6-34 NI-845x I2C Script Delay (Millisecond).vi.....................................................6-36 NI-845x I2C Script DIO Configure Line.vi ....................................................6-38 NI-845x I2C Script DIO Configure Port.vi.....................................................6-40 NI-845x I2C Script DIO Read Line.vi ............................................................6-42 NI-845x I2C Script DIO Read Port.vi.............................................................6-44 NI-845x I2C Script DIO Write Line.vi ...........................................................6-46 NI-845x I2C Script DIO Write Port.vi ............................................................6-48 NI-845x I2C Script Pullup Enable.vi ..............................................................6-50 NI-845x I2C Script HS Enable.vi....................................................................6-52 © National Instruments ix NI-845x Hardware and Software Manual
分享到:
收藏