Professional Documents
Culture Documents
Lab 5
Lab 5
Experiment #5
7 Seg Display
Purpose of Experiment:.
-Learn new tools used in the embedded systems and control it using AVR microcontrollers.
-Learn how to use 7-segment display and program AVR microcontroller to use it.
The following table contains the displayed number and data by using common cathode :
عند ادخال اشارة رقمٌة على هذه االطراف تحدث المقاطعة .وعندها ٌترك المتحكم الدقٌق البرنامج
الرئٌسً الذي ٌنفذه و ٌنتقل الً برنامج ISRلٌقوم بمعالجة المقاطعة.
.1ضبط االطراف التً ستستخدم للمقاطعة مثل INT 1أو INT 0لتعمل كدخل .input
.2ضبط نوع االشارة الكهربٌة التً ستسبب المقاطعة على حسب نوع الحساس أو
ٌ.3تم تفعٌل قبول استقبال ال م مقاطعة على الطرف المطلوب مثل .INT 0
Programs Practice
Example 1: make the circuit on proteus :
}
void main(){
//IO init
DDRB=0xff; //PORTB is output
DDRD.B2=0; //PD2 is input
PORTD.B2=1; //Enable pullup on PD2
DDRD.B3=0; //PD3 is input
PORTD.B3=1; //Enable pullup on PD2
//interrupt init
EICRA.ISC01=1; //int0,falling edge
EICRA.ISC00=0;
EICRA.ISC11=1; //int1,falling edge
EICRA.ISC10=0;
EIMSK.INT1=1; //Enable Int0
while(1){
PORTB =led7seg[cnt];
}
}