1 / 33

Counters

Counters. Topics Counter Overview Easy Counter VIs for: Event Counting Pulse Generation Pulse Measurement Frequency Measurement Position Measurement. Maximum Rise/Fall Time = 50ns. +5.0 V. high. +2.0 V. indeterminate. +0.8 V. low. 0 V. Minimum Pulse Width = 10ns.

Sophia
Télécharger la présentation

Counters

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Counters • Topics • Counter Overview • Easy Counter VIs for: • Event Counting • Pulse Generation • Pulse Measurement • Frequency Measurement • Position Measurement

  2. Maximum Rise/Fall Time = 50ns +5.0 V high +2.0 V indeterminate +0.8 V low 0 V Minimum Pulse Width = 10ns Counter Signals • Counters accept and generate TTL signals

  3. Gate • Out • Count Register • Source Parts of a Counter • Count Register • Stores the current count • Source • Input signal that changes the current count • Active edge (rising or falling) of input signal changes the count • Choose if count increments or decrements on an active edge • Gate • Input signal that controls when counting occurs • Counting can occur when gate is high, low, or between various combinations of rising and falling edges • Out • Output signal used to generate pulses

  4. Counter Pins • Counter gate and source are PFI pins • PFI stands for Programmable Function Input • Allows use of one pin for multiple applications For Example • Use pin 3 as digital trigger for analog input and counter gate

  5. Counter Terminology • Terminal Count • Term for the last count before a counter reaches 0 • When counter reaches max count it starts over at 0 • Resolution • The size of the counter register specified in bits • Counter register size = 2(resolution) - 1 • Typical resolutions - 16, 24, 32 bit • Timebase • Internal signal that can be routed to the source • Common timebases - 100kHz, 20MHz

  6. Different Counter Chips Less • 8253 (16-bit) • Used on Lab and 1200 Series Devices • Am9513 (16-bit) • Used on PC-TIO-10 and Legacy Devices (i.e. AT-MIO-16F) • DAQ-STC (24-bit) • Used on E-Series Devices • Created by NI • NI-TIO (32-bit) • Used on 660x Devices • Created by NI Features More

  7. Easy VIs • Built out of Intermediate VIs + Easy to use - Less flexible • Intermediate VIs • Built out of Advanced VIs + Very Flexible • Advanced VIs • Building blocks for other levels • Easy VIs • Advanced VIs • Intermediate VIs Counter Palette

  8. Perform basic counter operations Not suitable for more advanced applications Compatible with Am9513 and DAQ-STC Count Events or Time Generate Delayed Pulse Generate Pulse Train Measure Frequency Measure Pulse Width or Period Easy VIs

  9. Counter Applications • Event Counting • Simple Event Counting • Time Measurement • Pulse Generation • Single Pulse Generation • Pulse Train Generation • Pulse Measurement • Period Measurement • Pulse Width Measurement • Frequency Measurement • Position Measurement

  10. Active edges on source signal increment the count Active edge can either be rising or falling • Gate • Gate • Out • Out • Count Register • Count Register • Source • Source • Your Signal • Timebase Event Counting • Simple Event Counting • Time Measurement • Timebase has known frequency • Time elapsed = (Count) x (timebase period)

  11. Counter Armed • Source • Count • 0 • 1 • 2 • 3 • TC-1 • TC • 0 Event Counting • Count will increment for each rising edge on source • You can change active edge to falling • Counter will roll over when it reaches terminal count • Terminal count = 2(Counter resolution) - 1

  12. Source Edge Chooses active edge of source signal (rising or falling) Event Source/Timebase Chooses source signal Counter Chooses counter to address Start/Restart Set to TRUE to start/restart counter Stop Set to TRUE to stop counter Count Returns value stored in count register Seconds Since Start Time since counter started Count Events or Time VI

  13. Pulse Train • Single Pulse • Gate • Out • Single Pulse or Pulse Train • Count Register • Source • Timebase Pulse Generation • Generates a TTL signal on counter’s out pin

  14. High Polarity • Low Polarity • Delay • Width • Delay • Width • Pulse Period = • Delay + Width • 1 • Pulse Frequency = • Pulse Period • Width • Duty Cycle = • Pulse Period Pulse Characteristics • Pulse Polarity

  15. Timebase Source Internal or External Counter Chooses counter to address Pulse Polarity High or Low Pulse Delay & Width Seconds if using internal timebase Cycles if using external timebase Actual Delay & Width May differ from desired values because hardware has limited resolution Generate Delayed Pulse VI

  16. Pulse Polarity High or Low Counter Chooses counter to address Number of Pulses Set to 0 for continuous Set to -1 to stop Frequency (Hz) 1/(Pulse Period) Duty Cycle (Width)/(Pulse Period) Actual Parameters May differ from desired values because hardware has limited resolution Generate Pulse Train VI

  17. Period Measurement • Pulse Width Measurement • Pulse Period • Width • Gate • Out • Your Signal • Count Register • Source • Timebase Pulse Measurement • Use a timebase with a known frequency to measure characteristics of a unknown signal

  18. Armed • Yes • No • Gate • Source • Count • 0 • 1 • 2 • 3 • 4 • 4 • 4 Period Measurement • Count will increment for each rising edge on source • Counting can either start and end on rising or falling edges • Period of Gate = (Count) x (1/source frequency)

  19. Armed • Yes • No • Gate • Source • Count • 0 • 1 • 2 • 2 • 2 • 2 • 2 Pulse Width Measurement • Count will increment for each rising edge on source • Counting can start on either rising or falling edge • Width of Gate = (Count) x (1/source frequency)

  20. Counter Chooses counter to address Type of Measurement Measure high pulse width Measure low pulse width Measure period (rising edge to rising edge) Measure period (falling edge to falling edge) Timebase Routed to source DAQ-STC has choice of 100kHz or 20Mhz Pulse Width/Period (s) Returns value in seconds Valid False if counter rolls over Measure Pulse Width or Period VI

  21. Frequency Measurement • Your Signal • Low Frequency • High Frequency • Measure Pulse Width • or Period • Measure Frequency

  22. Measure period and take the inverse Frequency = 1/Period Pros Only uses one counter Good at low frequencies Cons Can see large error at high frequencies due to a phenomenon called synchronization error Low Frequency Measurement • Your Signal • Low Frequency • Measure Pulse Width • or Period

  23. GATE 0 1 2 3 3 Miss both edges SOURCE Miss one, catch one 0 1 2 3 4 Catch both edges 1 2 3 4 5 Synchronization Error • Gate period is exactly four source cycles • Measurement could be off by +/- 1

  24. Effect of Synchronization error • You can measure a frequency of F with error of 0.x FMAX = FSOURCE - (FSOURCE/(1+0.x)) • If frequency you are measuring exceeds acceptable error use Measure Frequency VI

  25. Still Period Measurement except: Gate is known Pulse from another counter Source is your signal Pro Works well at high frequencies Con Uses two counters High Frequency Measurement • Your Signal • High Frequency • Measure Frequency

  26. Frequency = (count of Counter 1)/(pulse width of Counter 0 Out) Synchronization error still exists in count of Counter 1 Error = (+/-1)/(period of Counter 0 Out) High Frequency Setup • Single Pulse Generation • Pulse Width Measurement • Gate • Out • Gate • Out • Count Register • Known Pulse • Count Register • Source • Counter 0 • Source • Counter 1 • Your Signal • Timebase

  27. Counter Chooses counter to address Gate Width (s) Desired length of pulse used to gate the signal The lower the signal frequency, the longer the width must be Frequency (Hz) Returns value in Hertz Valid False if counter rolls over NOTE: You must connect Gate of chosen counter to Out of other counter Measure Frequency VI

  28. Position Measurement • With a transducer called a quadrature encoder you can measure position • DAQ Signal Accessory has a quadrature encoder • NI-TIO is only counter chip that directly supports quadrature encoders • Possible to measure quadrature encoder with Am9513 and DAQ-STC

  29. Light Sensor • Light Source • Shaft • Code Track • Channel A • Channel B • Rotating Disk How Does an Encoder Work? • Quadrature Encoder • Shaft and disk rotate • Code track either passes or blocks light to sensor • Light sensor creates two pulse trains

  30. 900 phase difference • Channel A • Channel B • 900 phase difference • Channel A • Channel B Quadrature Encoder • Quadrature Encoders produce two pulse trains 90 degrees out of phase • Clockwise rotation • Channel A leads Channel B • Counter-Clockwise rotation • Channel B leads Channel A • Clockwise Rotation • Counter-Clockwise Rotation

  31. Gate • Out • U/D • Count Register • Source Up/Down Line • DAQ-STC counters also have an up/down line • DIO6 is up/down for counter 0 • DIO7 is up/down for counter 1 • TTL High = Count up • TTL Low = Count down

  32. Channel A • Channel A • Channel B • Channel B • Clockwise Rotation • Counter-Clockwise Rotation • Gate • Out • Channel B • U/D • Count Register • Source • Channel A • Simple Event Counting DAQ-STC and Encoders • Count on the falling edge of Channel A • Clockwise - B is high so count increments • Counter-Clockwise - B is low so count decrements • Channel B is hardwired to DIO6 on the DAQ Signal Accessory

  33. Chapter 6 Summary • Counters accept and generate TTL signals • The main components of a counter are the source, gate, out, and count register • National Instruments devices could have one of four different counter chips • E-Series devices use the DAQ-STC chip • The Easy VIs can be used to perform event counting, pulse generation, pulse measurement, and frequency measurement • A quadrature encoder is a transducer that converts rotary motion into two pulse trains which are out of phase by 90 degrees

More Related