Pulse Counter
This project is based on Motorola Microcontroller M68HC11A8. The system Pulse Counter gives the count of input pulse to the microcontroller on LED display. To simulate this circuit, initially activate Mixed Mode simulator from the Schematic Editor window. Simulation can be performed by selecting Transient analysis from Simulation menu.
This project includes microcontroller M68HC11A8, binary to 7 segment decoders and seven segment LED displays.
A clock generator is given to 7th pin of I/O PORTA of the microcontroller. For each pulse the controller receives, a counter is incremented. The controller outputs the count to 7 segment decoders which outputs the value to seven segment LED display. The value displayed is the total number of pulse given to microcontroller.
The source code written in assembly language and can be viewed from the
code editor window. It can be compiled after making any modifications (editing) and also debugged during simulation.
The program is as shown:
LDX #0x1000 ;initialize address for index addressing
BCLR 0x0026,X , 0b10000000 ;configure 7th pin PORTA as input
LDAA #0000 ;reset count=0 in seven segment display
STAA 4,X
LDAA 0,X
GO: BRCLR 0,X 0b10000000 GO ;wait here until a pulse is detected
INC 0x0004,x ;increment PORTB register
JMP GO ;jump to GO to wait for the next pulse
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.