Showing posts with label generator. Show all posts
Showing posts with label generator. Show all posts

Wednesday, April 10, 2013

PWM Generator Schematic

PWM waveforms are commonly used to control the speed of DC motors. The mark /space ratio of the digital wave-form can be defined either by using an adjustable analogue voltage level (in the case of a NE555 based PWM generator) or digitally using binary values. Digitally derived PWM waveforms are most often produced by the timer/counter modules in microcontrollers but if you do not want to include a microcontroller in your circuit it’s also quite simple to generate the signals using discrete logic components. An extension of the circuit shown can pro-duce two PWM waveforms from an 8-bit digital input word. Each signal has 15 val-ues. The 8-bit word can be produced for example from an expansion board fitted in a PC or from an 8-bit port of a processor which does not have built-in PWM capability or from a laptop’s printer port. 
Discrete PWM Generator Circuit Diagram
Discrete PWM Generator


The mark/space ratio is only programmable up to 15/16 rather than 16/16; a binary input of 0000 produces a continuous low on both outputs turning both motors off. Similar circuits often employ a dedicated ‘enable’ input to turn the motors off but it is not necessary in this design.

The diagram shows the circuitry required to produce just one waveform. For the full two channel circuit it is necessary to use an additional 74HC193. The clock signal produced by the HCF4060 generator can be used to drive both channels and the free flip flop in the 74HC74 package can be used for the second channel (the corresponding pin numbers are shown in brackets). Alto-gether the entire two channel circuit can be built using just four ICs. Link
ReadMore....

Monday, April 8, 2013

Random number generator using 8051

A  random number generator using 8051 that  displays a random number
between 0 & 99 is shown in this article. The circuit it self is very
simple and may not find any applications in serious embedded projects
and this article is just an illustration. The circuit is based on
AT89S51 microcontroller, two seven segment LED displays, two transistors
and few passive components.

Circuit diagram.

random number generator using 8051
Random number generator using 8051
The
two seven segment LED displays are multiplexed together and their data
lines are connected to Port0  of the microcontroller. Transistors Q1
and Q2 drives the corresponding displays D1 and D2. The driving signals
for there transistors are obtained from P1.1 and P1.2. Push button
switch S1,capacitor C1 and resistor R10 forms a debouncing reset
circuit. Resistor R9, capacitor C2 and pushbutton switch S2 will
provide an active low harware  interrupt signal at INTO (pin12) when
ever S2 is pressed. Here also R9 and C2 are meant for debouncing. After
power ON the display will show blank and when push button S2 is
pressed the display will show a random number between 0 and 99. For
another try you have to press the reset switch and then switch S2. If
you need a single digit setup only, the remove display D2 and
its associated components. Everything else is same.

Program.

ORG 000H
SJMP MAIN
ORG 003H // sets the starting address for the ISR
ACALL ISR // calls the ISR subroutine when S2 is pressed
RETI // return from interrrupt

MAIN:SETB IP.0 // this part sets the initial conditions
SETB TCON.0
SETB IE.0
SETB IE.7
MOV P0,#00000000B
MOV P1,#00000000B
MOV DPTR,#LUT // moves the starting address of LUT to DPTR

LABEL:MOV R6,#99D // this part generates the random number
LOOP:MOV A,R6
DJNZ R6,LOOP
SJMP LABEL

ISR: MOV A,R6 // Subroutine ISR displays the current random number
MOV B,#10D
DIV AB
SETB P1.2
ACALL DISPLAY
MOV P0,A
ACALL DELAY
MOV A,B
CLR P1.2
SETB P1.1
ACALL DISPLAY
MOV P0,A
ACALL DELAY
CLR P1.1
SJMP ISR
RET

DELAY: MOV R3,#02H // this subroutine creates 1mS delay for switching the displays
DEL1: MOV R2,#0FAH
DEL2: DJNZ R2,DEL2
DJNZ R3,DEL1
RET

DISPLAY: MOVC A,@A+DPTR // produces the digit drive pattern for the current digit in A
RET

LUT: DB 3FH // Look up table
DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH
END

About the program.

The
first part of the program is the portion labelled MAIN which sets the
initial conditions and the interrupt parameters. The next part is the
loop named LABEL which loads 99D to register R6  then decrements it by 1
until 0 and then repeats the cycle again. This is the part which
generates the random number. Every time R6 is decremented the resultant
value is moved to accumulator A. Next part is the interrupt service
routine which is written as a subroutine named ISR. When ever there is
an interrupt at INT0 (push button S2 is pressed), the ISR is called.
The ISR perfoms necessary mathematical manipulations on the content of A
in order to split out the two digits and then proceeds to show it on
the display. Subroutine DELAY produces roughly 1ms delay for switching
the displays. Subroutine DISPLAY adds the current value in A with the
address stored in DPTR (starting address of LUT) and moves the target
content to A. The result will be the digit drive pattern for the
current digit in A.
ReadMore....

Thursday, April 4, 2013

A Simple Function Generator

Simple triangle-wave generators have a weakness in that the waveform of their output signal normally cannot be modified. The circuit presented here makes it possible to smoothly alter the waveform of a linearly rising and steeply trailing saw-tooth signal through a symmetrical triangle-wave to a slowly trailing, steeply rising linear sawtooth. The wanted waveform may be selected independently of the frequency, which can also be varied uniformly from 0.2 Hz to 8 kHz. At the same time, a rectangular signal with variable duty cycle (also independent of frequency) is available at the rectangular-signal output of the circuit.
Simple_Function_Generator_Circuit_Diagram1 
The circuit consists of integrator IC1b, whose output is applied to comparator IC1c. The output of the comparator is a rectangular signal The output of IC1b is raised by amplifier IC1d to a level that allows the full output voltage range of the operational amplifier to be used. Op amp IC1a provides a stable virtual earth, whose level is set to half the supply voltage with P1. The smooth setting of the frequency is made possible by feedback of part of the output of the comparator to the input of the integrator via P2. This preset is usually not provided in standard triangle-wave generators. Network D1-R1-D2-R2-P3 makes it possible to give integrator capacitor C3 different charging and discharge times.
This arrangement enables the output signal at A1 and the duty cycle of the rectangular wave signal at A2 to be varied. Varying the amplification factor with P5 has no effect on the frequency set with P2. The slope of the signal edges, the transient responses, and the output voltage range (rail-to-rail or with some voltage drop) depend on the type of op amp used. The TL084 used in the prototype offers a good compromise between price and meeting the wanted parameters. The circuit is best built on a small piece of prototyping board. The circuit draws a current of not more than 12 mA.
Brief parameters:
Provides triangle-wave, sawtooth or rectangular signal
Waveform variable independently of frequency (triangle wave and sawtooth)
Duty cycle of rectangular signal can be set independently of frequency
Applications:
Test and measurement
Pulse-width control
Summary of preset action:
P1 – sets virtual earth to a level equal to Ucc/2;
P2 – sets the frequency;
P3– sets the waveform;
P4 – sets the hysteresis of the comparator (frequency and amplitude of the triangle-wave signal)
P5 – sets the amplification of the triangle-wave and sawtooth signals.
ReadMore....