MC68HC11A8 - Signal Generator
The circuit is designed to generate Sine wave, square wave, triangular wave and positive spike signal. To simulate circuit in this project, initially activate Mixed Mode simulator from the Schematic Editor window. Simulation can be performed by selecting Run Transient analysis (Oscillograph) or Analysis -> Transient Analysis from Simulation menu.
The PORT C of the microcontroller is coded to toggle from 00 to FF. With 500 KHz clock, all pins of
PORT C outputs square wave of frequency 27.8 KHz. A first order Bessel low pass filter of quality factor (Q) 5 and cut off frequency 8 KHz is used to convert square wave from
PC0 to sine wave. The filter is generated using ‘Design Active Filter’ tool of EDWinXP.
The integrator converts PC1 signal to triangular wave. Component value is calculated using following formula:
The integrator converts PC1 signal to triangular wave. Component value is calculated using following formula:
The source code written either in C or Assembly language can be viewed from the
code editor window
The program is as shown:
LDAA #0xFF ;
STAA 0x100; Configure Port C as output DDRC = 0xFF
L1: LDAA #0x00; Clear ACC A
STAA 0x1003; Copy to PORT C
BRA L2 ; This instruction is to induce delay to make Ton = Toff
L2: LDAA #0xFF ;
STAA 0x1003 ; Toggle PORT C to 0xFF
BRA L1 ; Repeat
The source code in the
code editor window
has to be
compiled
after making any modifications
(editing).
Also the code can be
debugged
during
simulation.