0% found this document useful (0 votes)
18 views

Lab1 - 2 Eng

This document describes three experiments for a lab on delays using instructions and shift registers. The first experiment has students generate pulses on port A0 and measure them. The second has them write subroutines to generate delays and use them to produce a 1 kHz square wave and blink an LED. The third connects a shift register to an AVR port to control a LED bar and have the lights sweep back and forth. Students are to answer questions and provide code for each experiment in a lab report.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Lab1 - 2 Eng

This document describes three experiments for a lab on delays using instructions and shift registers. The first experiment has students generate pulses on port A0 and measure them. The second has them write subroutines to generate delays and use them to produce a 1 kHz square wave and blink an LED. The third connects a shift register to an AVR port to control a LED bar and have the lights sweep back and forth. Students are to answer questions and provide code for each experiment in a lab report.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LAB 1-2

DELAY WITH INSTRUCTIONS

OBJECTIVE:

• Execute instructions to create delays using subroutines.

• Perform communication with shift registers.

REFERENCES:

• Lab manual chapter 1-2.

EXPERIMENT 1:

a) Use the following program:

.include "m324PAdef.inc"
.org 00
ldi r16,0x01
out DDRA, r16
start:
sbi PORTA,PINA0
cbi PORTA, PINA0

rjmp start

Connect PA0 to a measurement channel on the TEST STATION and measure pulse forms
using an oscilloscope.

EXPERIMENT 2:

a) Write a subroutine Delay1ms and use it to write a program to generate a 1KHz square
wave on PA0.
b) Use this subroutine to write subroutines Delay10ms, Delay100ms, and Delay1s.
c) Use the Delay1s subroutine to write a program to blink/turn off an LED connected to
PA0.

https://doe.dee.hcmut.edu.vn/
LAB 1-2
DELAY WITH INSTRUCTIONS

EXPERIMENT 3:

a) Connect the necessary signals from an AVR port to the control signals of the shift
register on header J13. Connect the output of the shift register to a LED bar.
b) Using the sample programs from the experiment guide, write a program to create a
gradually lit LED effect from left to right, then gradually turn them off from left to right
after every 500ms.

https://doe.dee.hcmut.edu.vn/
LAB REPORT
Group:
Class Group: Subject:

EXPERIMENT 1:

1. Answer the following questions:


a. Capture a pulse waveform on PA0.
b. What is the frequency, duration of the high signal, and duration of the low signal?
c. Explain the measured results.

EXPERIMENT 2:

1. Answer the following questions:


a. How to calculate the number of machine cycles needed to execute the Delay1ms
subroutine. Present a simulation image.
b. Image of a 1KHz square wave on PA0.
c. What is the error?
2. Source code for 2.c with comments.
..........................................................................................................................

EXPERIMENT 3:

1.Answer the following questions:


a. Describe the connections on the experimental kit.
b. According to the datasheet of 74HC595, what is the highest clock frequency it can
operate at?
c. How do you expand the display to 16 LEDs?
2.Source code with comments.
..........................................................................................................................

https://doe.dee.hcmut.edu.vn/

You might also like