Vous êtes sur la page 1sur 2

8051 Based Function Generator

Inderpreet Singh
er.inderpreet@gmail.com
Abstract—This paper introduces the development of a simple used. The DAC0808 requires a negative reference voltage to
function generator using a microcontroller. The system is function properly. A negative voltage converter can be used,
capable of producing square, triangular and sine wave. The but for our experiment, we used the charge pump of the
sine wave is produced by using lookup table values and a MAX232 level converter.
digital to analog converter. The entire firmware was written in
assembly for exact control over timing and to avoid overheads. The circuit diagram is shown in fig 2. The controller
operates at 24 MHz. All components are mounted on a single
PCB and a regulated external power supply was used.
I. INTRODUCTION
The function generator is a very useful device in testing III. THE PROGRAM
and general experiments. The basic functionality includes The complete program was written in assembly because
multiple signal types and the ability to change the frequency an exact control over the timing was required. Also if a
as required. A simple microcontroller can be used in program is written in assembly, the overheads generated by a
conjunction with a digital to analog converter to produce compiler are avoided if any. The subroutines for increment
required outputs. of frequency and decrement of frequency were written as
For our experiment, an AT89C51 microcontroller was interrupt routines. The lookup table for the sine wave was
used with the DAC0808. The complete unit operates off a 5 generated by hand calculations and was written into the
volt supply and all other voltages are generated as per code.
requirement, by the device itself.
IV. TESTING
II. THE CIRCUIT The system was assembled, programmed and tested using
The basic block diagram is shown in fig 1. To make the a cathode ray oscilloscope. All operations were tested
device user friendly, an LCD and a keyboard of 5 keys was manually for correctness of operation.
+ 5 V

+ 5 V
U 4 R 3 V r e f f
1 1 4 C 8
N CR e f f ( + ) C 6
C 4 1 0 K 1 0 V C 7 A l l c a p s 1 0 u f
1 0 u F U 1 5 R 2
C 3 3 1 3 9 6 A 1 1 5
1 9 E A / V P P 0 . 03 8 7 A 2 R e f f 2( - )

10
11

13
R 1 X 1 P 0 . 13 7 8 A 3 G r n d 5

6
2

8
8 . 2 K 3 0 p F Y 1 P 0 . 23 6 9 A 4 5 K U 5
P 0 . 33 1 0 A 5
C 2-

V-
C 2

V+
C 2+

1 IN
2 IN
1 IN
2 IN
5 4
C R Y S 1 T8 A L P 0 . 43 4 1 1 A 6 I o M A X 2 3 2

T
T
R
R
X 2 P 0 . 53 3 1 2 A 7 1 6
2 9 P 0 . 63 2 A 8 C o m p
VEE

3 0 p F 9 P S E N P 0 . 7
R E S E T 2 1 D A C 0 8 0 8 C 1
P 2 . 02 2 0 . 1 u F
P 2 . 12
T
T
3

J 2
T
T
1 6 3 U
U
U
U
1 7 W R P 2 . 22 4 1O
2O
2O
1O
C 1-
C +

1 4 1 5 R D P 2 . 32 5
R
R
T
T

1 3 T 1 P 2 . 42 6 V e e
1 2 P 2 . 52 7
14

12

1 1 P 2 . 62
1

1 8
1 0 2 P 1 . 0 P 2 . 7
9 3 P 1 . 1 C 5
8 4 P 1 . 2
7 5 P 1 . 3 1 4
6 6 P 1 . 4 T 0 3 0
5 + 5 V 7 P 1 . 5 A L E 1/ P1
4 P 1 . 6 T X D 1
IN T 1
IN T 0

8 0
3 P 1 . 7 R X D
2
8 0 C 5 1
1
12
13

L C D C o n n e c t o r
T R IA N G U L A R
SQ U AR E

D EC
IN C
S IN E

S W 6 S W 7 S W 8 S W 9 S W 1 0

Figure 2. The circuit diagram


T it le
< T i t le >

S i z e D o c u m e n t N u m b e r R e v
A < D o c > < R e v C o d e >

D a t e : S u n d a y , F e b r u a Sr y h e 0 e 5 t 1, 2 0o 0 f 6 1
Microcontroller
With firmware
DAC V. RESULTS
Buffer & Filter

The device works as expected and the sine wave was


perceived correct. The buffer and filter helps in correcting
step errors. The output frequency is a direct function of the
LCD frequency of the crystal being used. Due to the clock
limitation of the AT89c51 at 24Mhz, very high trails could
not be conducted.
Output
For future work, the device can use a controller with an
Keyboar inbuilt DAC and higher operating frequency.
d of 5
buttons

Figure 1. Basic Block Diagram

Vous aimerez peut-être aussi