µC-Based Technique Yields Configurable Timing Signals

July 20, 2006
Many electronics applications require various processes to be monitored and controlled, generally under microcontroller supervision. The proper timing to, say, turn a motor on or off, or to open or close a valve, is critical for an efficient

Many electronics applications require various processes to be monitored and controlled, generally under microcontroller supervision. The proper timing to, say, turn a motor on or off, or to open or close a valve, is critical for an efficient control system.

Here's a simple and low-cost method to obtain five independent voltageadjustable clock signals that offer a timing resolution of better than 0.1%. This accuracy holds over a very wide range of time—from 0.5 to 5000 seconds. What's more, the five channels could be daisychained to obtain a sequence of pulses having different durations.

The technique employs a reference crystal oscillator for the system clock. This ensures the exact timing for optimum microcontroller efficiency. The circuit produces either five independent monostable multivibrators or four monostables and one astable multivibrator. The astable could be used for synchronization purposes. A handful of microcontroller program lines are enough to configure each timer register to meet the application timing needed.

For this example, we're providing complete hardware and software information, so there's no need to know how the PIC16F873 enhanced flash 8-bit microcontroller works. The microcontroller's on-board 10-bit analog-to-digital converter (ADC) transforms an analog voltage input, proportional to the desired period time, into a digital value to set a channel timer register.

The ADC can multiplex the analog input over five channels, allowing five independent and accurate time settings. Because the ADC resolution of 10 bits is very good, the circuit can attain a timing accuracy of nearly 0.1%. The timing is adjusted by multiturn trimmers connected at each channel input (up to five).

Figure 1a shows the hardware setup to realize both the monostable and the astable for Channel 0. Depending on the value of mode input M0, the O0 output is either a single-shot pulse (monostable) or a periodic pulse (astable). Output O0 is astable when M0 = 1.

Figure 1b depicts the monostable-only configuration for Channels 1 through 4. Each channel has two control signals (Rn, Sn), one input (Tn), and one output (On). The Rn control switches the time/voltage setting between 100 s/V (Rn = 0) and 1000 s/V (Rn = 1), allowing ranges of 0.5 to 500 seconds or 5 to 5000 seconds. The Sn control serves as the trigger signal; a rising edge begins the monostable period. Tn is determined by the analog input voltage (0 to 5 V), and On is the active-low pulse output. Outputs O1 to O4 always work as monostables. Figure 1c describes the pinout of the PIC16F873 microcontroller.

To generate a pulse of duration Tn = 123 seconds, just use the trimmer to adjust the input voltage to 1.23 V and set Rn = 0. Key control values and the results they produce are shown in the table. We used a 10-MHz reference crystal oscillator to obtain the values cited here. To program the microcontroller, download the code listing (DB2213codelisting.doc) below.

Caution: Once the microcontroller registers are set, their values cannot be changed easily. This limitation, along with the technical and programming knowledge required to use the microcontroller, are the main disadvantages of the method.

To download the listings, click Download the Code.

Sponsored Recommendations

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!