QuestionQuestion

Overview

The purpose of this lab is to control and program the MC8051 Counters of the micro-controller in a given sequence. The program displays current count of Counter 0 on port 1 (P1) and Counter 1 on port 2 (P2). The initial P1 value is F0H and is E1H for port P2. Display update takes place on every counter’s initiated clock pulse. Counter0 and Counter1 are programmed in mode 2 using the polling mode, no interrupts. The status of TF0 and TF1 are displayed on Port 3 bit 0 (P3.0) and bit 1 (P3.1) respectively.

Steps

1. First, configure and initialize the required parallel ports; Counter 0 to mode 2, and Counter1 to mode 2. The Main program starts at code memory address 40H, The main program only function is updating P1 & P2 and displaying the two overflow flags on port 3.
2. Second, in the main program configure the two Counters for Mode 2 with the given initial two counts. Start Counterr0, initiate the external clock pulses on your Keil simulator, and display its accumulated count value on P1. Continue updating port P1 and the status of TF0 on P3.0. Do the same for Counter1 after Counter0 overflows.
3. Third, configure the debugger display to include the Timer0, Timer1, P1, P2, P3, and the Clock Control windows. Make sure that the Timers windows are configured for no external interrupts and external pin clocks. The clock window can be used to control the CPU clock speed, which can help during the debugging process.
4. Run the program and monitor all displayed windows. Verify the operation of the two Counters, TF0 & TF1, and the three display ports.
5. Test and debug your program. Also document and submit your final report along with the well documented list file. You can slow the Counters and Ports update by controlling the MC clock using the clock window in the PREPHERALS selection.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

ORG 00
JMP MAIN
ORG 40H
MAIN:
CLR P3.0 ;P3.0 is output
CLR P3.1 ;P3.1 is output
SETB P3.4 ;P3.4 is input as external clock for counting
SETB P3.5 ;P3.5 is input as external clock for counting
MOV TMOD, #01100110B ;set counters to mode 2
MOV TH0, #0F0h ;configure for auto reload
MOV TH1, #0E1h
MOV P1, #0F0h ;set initial values for P1 and P2
MOV P2, #0E1h
MOV TL0, #0F0h ;initialize counters
MOV TL1, #0E1h
MAIN_LOOP:
SETB TR0 ;start counter 0
READC0:
MOV A, TL0
MOV P1, A ;read counting value and display to P1
JNB TF0, READC0 ;do this while counter 0 overflows

CLR TR0 ;stop the counter
SETB P3.0 ;set overflow flag display

SETB TR1 ;start counter 1
READC1:
MOV A, TL1
MOV P2, A ;read counting value and display to P1
JNB TF1, READC1 ;do this while counter 1 overflows...

By purchasing this solution you'll be able to access the following files:
Solution1.A51 and Solution2.A51.

50% discount

Hours
Minutes
Seconds
$10.00 $5.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats