Transcribed TextTranscribed Text

Vee +Vcc I.ED C1 I R3 RESET I Vecs 89C52 R2 R1 LA Q1 XIAL1 01 PS.2 12MHz XIAL2 Cnd I C2 C3 Write a program for the microcontroller 89C52 based circuit that flashes the LED shown in the above figure where the on period is updated whenever the button b1 is pressed. Pressing duration to the b1 will be recorded between 0.001seconds to 6.000 seconds as the new half period of the LED (duty cycle is 50%). Current flashing period of the LED must not be affected until the b1 is unpressed. Determine the component values R1, R2, R3, C1, C2 and C3. lac=10mA, VAc=1.2V for the LED and BC547B can be used as Q1.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

$DATE ()
$TITLE (LEDDriver)
cnt0 EQU 030H                                  ; Low byte of 16 bit counter that measures LED ON/OFF time
cnt1 EQU 031H                                  ; High byte of 16 bit counter that measures LED ON/OFF time
maxValue EQU 032H                               ; Flag that indicates that maximum time (6s) is measured
compare EQU 033H                               ; Flag that returns a two 16 bit value comparison result
btncnt0 EQU 034H                               ; Low byte of 16 bit counter that measures button pressed time
btncnt1 EQU 035H                               ; Low byte of 16 bit counter that measures button pressed time
pressed EQU 036H                               ; Flag that indicates that the button was pressed (previous state)
    ORG 0000H
    AJMP main
    ORG 000BH
    AJMP timer0_int
    SETB P3.2                                  ; Set P3.2 to input, reads the switch
    SETB P3.0                                  ; Set LED to ON
    MOV R6, #017H                              ; Set value of 6s in R6:R7 to LED half period - default
    MOV R7, #070H
    MOV cnt0, #000H
    MOV cnt1, #000H                            ; Set value of 0 for measuring the LED ON/OFF elapsed time in cnt1:cnt2
    MOV maxValue, #000H                        ; Set to not reached
    MOV pressed...
$25.00 for this solution

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.

Upload a file
Continue without uploading

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