background image

USB-4301 User's Guide 

Functional Details 

19 

Example 1 

Problem

: The application generates an active low pulse every time a button

1

 is pressed.

 

You need a simple 

event counter to count button presses. 

Solution

: Any of the counters can be configured to do this fairly easily. Do the following: 

1.

 

Connect the input signal to the counter input pin, and select that input pin as the source for the counter. 

2.

 

Program the counter to: 

o

 

Count negative edge transitions 

o

 

Count up 

o

 

No recycle 

o

 

Count in binary mode 

o

 

Reload from the Load register 

o

 

Disable special gate 

o

 

No gate control 

o

 

Make output control inactive  

3.

 

Load the Load register with a value of 0 to start counting. 

Example 2 

Problem

: An external device generates an active high signal while a switch is depressed. The switch is 

depressed for at most one second. You need to measure the time the switch is depressed with microsecond 

accuracy. 

Solution

: Microsecond accuracy for one second requires counting to at most 1,000,000. However, each counter 

can count only to 65,535. You can use some counter features to 

cascade

 two of the counters in order to count 

higher. Configure Counter 1 and Counter 2 as follows:  

Configure Counter 1: 

1.

 

Using 

Insta

Cal, configure the counter 1 source for 1 MHz. As shown in 

the "

Internal frequency values

"

 

table on page 16, an internal base frequency of 1.0000 MHz corresponds to 

FREQ1

.  

The internal base frequency of 1 MHz provides an ideal way to measure time to the microsecond, since 

1 count at 1 MHz equals 1 microsecond. 

2.

 

The counter can count either up or down, so for this example set the counter to count up. 

3.

 

The counter should count only while the input signal from the switch is active. To do this, connect the input 

signal to the gate 1 pin (

GAT1

), and configure the counter gate control for active high level Gate 

n

.  

4.

 

Load the Counter 1 Load Register with a value of zero, since you want the counter to reach as high a count 

as possible before reaching TC. 

5.

 

To cascade Counter 1 with Counter 2, turn Recycle mode 

on

. This is done so Counter 1 continuously 

counts to TC, then wraps around and starts counting at 0 again.  

6.

 

Set reload to always load from the Load register, since you want to restart at 0 after every TC. 

7.

 

Enable binary mode. 

8.

 

Set the Counter 1output to inactive; Counter 1 requires no special gating. 

                                                           

1

 For more information about debouncing mechanical switches, refer to the "

Low pass to de-bounce inputs

" section 

in MCC's 

Guide to Signal Connections

 . This document is available on our web site at  

www.mccdaq.com/signals/signals.pdf

. 

Содержание USB-4301

Страница 1: ......

Страница 2: ...USB 4301 9513 based Counter Timer User s Guide Document Revision 5 March 2009 Copyright 2009 Measurement Computing Corporation...

Страница 3: ...n For specific information please refer to the terms and conditions of sale Harsh Environment Program Any Measurement Computing product that is damaged due to misuse or any reason may be eligible for...

Страница 4: ...No license is granted by implication or otherwise under any patent or copyrights of Measurement Computing Corporation All rights reserved No part of this publication may be reproduced stored in a retr...

Страница 5: ...Details 11 USB 4301 block diagram 11 External components 12 USB connector 12 Status LED 12 Power LED 12 Screw terminal banks 12 Counter terminals INP1 to INP5 GAT1 to GAT5 and OUT1 to OUT5 14 Digital...

Страница 6: ...21 Counter 21 Digital input output 22 Interrupt Input 22 Memory 23 Microcontroller 23 USB 5V voltage 23 LEDs 23 Power 23 USB specifications 24 Environmental 24 Mechanical 24 Screw terminal connector t...

Страница 7: ...s of manuals and help topic titles and to emphasize a word or phrase For example The InstaCal installation procedure is explained in the Quick Start Guide Never touch the exposed pins or circuit conne...

Страница 8: ...with your USB 4301 refer to the Quick Start Guide that shipped with your device The Quick Start Guide is also available in PDF at www mccdaq com PDFmanuals DAQ Software Quick Start pdf Check www mccd...

Страница 9: ...al documentation In addition to this hardware user s guide you should also receive the Quick Start Guide available in PDF at www mccdaq com PDFmanuals DAQ Software Quick Start pdf This booklet supplie...

Страница 10: ...301 To connect the USB 4301 to your system turn your computer on and connect the USB cable to a USB port on your computer or to an external USB hub that is connected to your computer The USB cable pro...

Страница 11: ...igital output 9513 CTR1 Input CTR1 Gate CTR2 Input CTR2 Gate CTR2 Output CTR3 Gate CTR3 Output CTR4 Input CTR4 Gate CTR4 Output CTR5 Input CTR5 Gate Counter 1 Counter 2 Counter 3 Counter 4 Counter 5 U...

Страница 12: ...power supply is required Status LED The Status LED indicates the communication status of the USB 4301 It flashes when data is being transferred and is off when the USB 4301 is not communicating This L...

Страница 13: ...connection DI CTL One oscillator output connection OSC One interrupt input connection INT Two voltage output power connections 5V Two ground connections GND Seven pins are reserved RSVD Do not connect...

Страница 14: ...ck gate and output sources are software selectable You can configure each counter to count up or down Digital input DI0 to DI7 and output DO0 to DO7 terminals You can connect up to eight digital input...

Страница 15: ...th this option digital outputs are not set to the value written until an active edge occurs on this pin Save the current value of a counter You can configure this option for each counter individually...

Страница 16: ...ounter 1 gate pin GATE2 Counter 1 gate pin GATE3 Counter 1 gate pin GATE4 Counter 1 gate pin GATE5 Counter 1 gate pin FREQ1 Internal base frequency FREQ2 Internal base frequency 10 FREQ3 Internal base...

Страница 17: ...as two associated 16 bit registers which can be used to store count values the Load register and the Hold register The Load register is used to load the starting value for the counter The Hold registe...

Страница 18: ...s it easy to decode long binary numbers For example 0b1001 0001 0000 1001 equals 9109 in BCD Binary Coded Decimal mode and equals 37 129 in binary mode In BCD mode the counter can only contain values...

Страница 19: ...onfigure Counter 1 1 Using InstaCal configure the counter 1 source for 1 MHz As shown in the Internal frequency values table on page 16 an internal base frequency of 1 0000 MHz corresponds to FREQ1 Th...

Страница 20: ...is option is active the digital inputs always return the same value until a new active edge is received on the interrupt pin When the active edge is received the current value is latched at the input...

Страница 21: ...l or edge counter 1 5 gate input Active high level previous gate or next gate All external gate signals GATx individually pulled up through 47 K resistors to 5 V Internal Active high previous counter...

Страница 22: ...ll down configurations are available using the DI CTL terminal block pin 19 The pull down configuration requires the DI CTL pin pin 19 to be connected to a GND pin pin 10 20 38 or 48 For a pull up con...

Страница 23: ...ange terminal block pin 8 and 18 Connected to self powered hub Note 4 4 75 V min to 5 25 V max User 5V output current terminal block pin 8 and pin 18 Bus powered and connected to a self powered hub No...

Страница 24: ...ND min 28 AWG D D USB cable length 3 meters max Environmental Table 10 Environmental specifications Operating temperature range 0 to 60 C Storage temperature range 40 to 85 C Humidity 0 to 90 non cond...

Страница 25: ...round 11 RSVD Do not connect 39 RSVD Do not connect 12 RSVD Do not connect 40 RSVD Do not connect 13 RSVD Do not connect 41 RSVD Do not connect 14 RSVD Do not connect 42 RSVD Do not connect 15 RSVD Do...

Страница 26: ...the following conditions must be met The host computer peripheral equipment power sources and expansion hardware must be CE compliant Equipment must be operated in a controlled electromagnetic enviro...

Страница 27: ...Measurement Computing Corporation 10 Commerce Way Suite 1008 Norton Massachusetts 02766 508 946 5100 Fax 508 946 9500 E mail info mccdaq com www mccdaq com...

Отзывы: