51
INDEX Sr.No. Name of Practical Date Remark Sign 1. Toggle Port LED 07/01/2015 2. Simulate Binary Counter at Port 07/01/2015 3. Generate delay using TIMER_0 14/01/2015 4. Stepper Motor(clockwise/Anticlockwise) 14/01/2015 5.

Embedded System Practical manual (1)

Embed Size (px)

Citation preview

Page 1: Embedded System Practical manual (1)

INDEXSr.No. Name of Practical Date Remark Sign

1. Toggle Port LED 07/01/2015

2. Simulate Binary Counter at Port

07/01/2015

3. Generate delay using TIMER_0 14/01/2015

4. Stepper Motor(clockwise/Anticlockwise

)

14/01/2015

5. Generating square wave at port pin

21/01/2015

6. Generating Triangular wave at port pin

21/01/2015

7. Sine wave generation using look-up table

21/01/2015

8. Microcontrollers communicating over a serial

link

28/01/2015

9. Read switch-status from i/p port and

display at o/p port

04/02/2015

10. using Input Capture Pin (ICP), measure pulse width & display

at o/p port

11/02/2015

11. Working of Interrupt_0 on fallingedge

18/02/2015

Page 2: Embedded System Practical manual (1)

Practical No: 1 –“Toggle Port LED”

Aim:Write a program in Assembly/C programming language to alternately ON/OFF LEDs connected to two different ports. Draw appropriate circuit diagram to demonstrate the above problem. Write description of the above program and explain hardware and software part of above program. Draw o/p waveform if necessary.

Softwares used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

1. Setting a logic-high on the LSB of PORTA and logic-low on PORTB. 2. Setting a delay of 0.5 sec.

Page 3: Embedded System Practical manual (1)

Circuit Diagram:

Page 4: Embedded System Practical manual (1)

Program:

#include <90s8535.h>

#include <delay.h>

// Declare your global variables here

void main(void){

PORTA=0xff;DDRA=0xff;

PORTB=0xff;DDRB=0xff;

while (1){

PORTA=PORTA^PORTB;PORTB=PORTB^PORTA;

};}

Conclusion:

By using the delay function provided by the program we can turn off and on the leds on any ports of our choice.

Page 5: Embedded System Practical manual (1)

Practical No.2- “Simulate Binary Counter at Port”

Aim:

Write a program in Assembly/C programming language to simulate binary counter (8 bit) on LEDs use one of the four ports of Mc of output interface to 8 LEDs (LEDs should glow one – by – one) . Explain hardware and software part of above program.Draw o/p waveform if necessary.

Softwares used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

Setting a delay of 0.5 sec.

Page 6: Embedded System Practical manual (1)

Circuit Diagram:

Page 7: Embedded System Practical manual (1)

Program :

#include <90s8535.h> #include

<delay.h>

void main(void){PORTA=0x00;DDRA=0xff;

while (1){

//PORTA=0x01;DDRA=0x00;PORTA=PORTA+PORTA;DDRA=PORTA;if(PORTA==0x00){

PORTA=0x01;

}delay_ms(200);

};}

Page 8: Embedded System Practical manual (1)

Practical No: 3 -“Generate delay using TIMER_0”

Aim:

Write a program in Assembly/C programming language to alternately ON/OFF LEDs connected to two different ports. Draw appropriate circuit diagram to demonstrate the above problem. Write description of the above program and explain hardware and software part of above program. Draw o/p waveform if necessary.

Softwares used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

3. Setting a logic-high on the LSB of PORTA and logic-low on PORTB. 4. Setting a delay of 1 sec.

Page 9: Embedded System Practical manual (1)

Circuit Diagram:

Page 10: Embedded System Practical manual (1)

Program:

#include <90s8535.h>

unsigned int timecount=0;

interrupt [TIM0_OVF] void time0_ovf_isr(void){

TCNT0=6;if(++timecount==2){

PORTA=PORTA^0x80;timecount=0;

}}

void main(void){

DDRA=0x80;TCCR0=0x02;TCNT0=0x00;TIMSK=0x01;#asm("sei");

while (1){

};}

Page 11: Embedded System Practical manual (1)

Practical No: 4 “Stepper Motor” (clockwise/Anticlockwise)

Aim:

Write a program in Assembly/C programming language to alternately ON/OFF LEDs connected to two different ports. Draw appropriate circuit diagram to demonstrate the above problem. Write description of the above program and explain hardware and software part of above program. Draw o/p waveform if necessary.

Softwares used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

5. Setting a logic-high on the LSB of PORTA and logic-low on PORTB. 6. Setting a delay of 1 sec.

Page 12: Embedded System Practical manual (1)

Circuit Diagram:

Page 13: Embedded System Practical manual (1)

Program:

#include <90s8535.h> #include

<delay.h>

int count1, count2 ;

void main(void){

PORTA=0x01;DDRA=0xFF;

PORTB=0x01;DDRB=0xFF;

count1 = 0 ; count2

= 0 ;

while (1){

delay_ms(200) ;PORTA = PORTA + PORTA ; count1++ ;if(count1 == 7){

count1 = 0 ; delay_ms(200) ; PORTA = 0x01 ;

}

delay_ms(200) ;PORTB = PORTB + PORTB ; count2++ ;if(count2 == 7){

count2 = 0 ; delay_ms(200) ; PORTB = 0x01 ;

}}

}

Page 14: Embedded System Practical manual (1)

Practical No: 5 “Generating square wave at port pin”

Aim:

Write a program in Assembly/C programming language to alternately ON/OFF LEDs connected to two different ports. Draw appropriate circuit diagram to demonstrate the above problem. Write description of the above program and explain hardware and software part of above program. Draw o/p waveform if necessary.

Softwares used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

7. Setting a logic-high on the LSB of PORTA and logic-low on PORTB. 8. Setting a delay of 1 sec.

Page 15: Embedded System Practical manual (1)

Circuit Diagram:

Page 16: Embedded System Practical manual (1)

Program:

#include <90s8535.h>

unsigned int timecount=0;

interrupt[TIM0_OVF] void timeo_ovf_isr(void){

TCNT0 = 6; if(++timecount==2){

PORTA=PORTA^0x80;timecount=0;

}}

void main(void){

DDRA = 0x80;TCCR0 = 0x02;TCNT0 = 0x00;TIMSK = 0x01; #asm("sei");

while (1){};

}

Page 17: Embedded System Practical manual (1)

Practical No: 6 “/2015”

Aim:

Write a program in Assembly/C programming language to alternately ON/OFF LEDs connected to two different ports. Draw appropriate circuit diagram to demonstrate the above problem. Write description of the above program and explain hardware and software part of above program. Draw o/p waveform if necessary.

Softwares used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

9. Setting a logic-high on the LSB of PORTA and logic-low on PORTB. 10. Setting a delay of 1 sec.

Page 18: Embedded System Practical manual (1)

Circuit Diagram:

Page 19: Embedded System Practical manual (1)
Page 20: Embedded System Practical manual (1)

Program:

#include <90s8535.h> int count = 9, i ;int arrValuesHigh[] = {245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, 251, 251,

252, 252, 253, 253, 254, 254, 255, 255} ;int arrValuesLow[] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9} ;

void main(void){

PORTA=0xFF;DDRA=0xFF;

while (1){

if(count == 9){

for(i=0 ; i<22 ; i++){

PORTA = arrValuesLow[i] ;}for(count=9 ; count!=245 ; count++){

PORTA = count ;}for(i=0 ; i<22 ; i++){

PORTA = arrValuesHigh[i] ;}

}if(count == 245){

for(i=21 ; i>=0 ; i--){

PORTA = arrValuesHigh[i] ;}for(count=245 ; count!=9 ; count--){

PORTA = count ;}for(i=21 ; i>=0 ; i--){

PORTA = arrValuesLow[i] ;}

}};}

Page 21: Embedded System Practical manual (1)

Practical No: 8 - “Microcontrollers communicating over a serial link”

Aim:

Write a program in Assembly/C programming language to alternately ON/OFF LEDs connected to two different ports. Draw appropriate circuit diagram to demonstrate the above problem. Write description of the above program and explain hardware and software part of above program. Draw o/p waveform if necessary.

Software’s used:

CodeVisionAVR Software. WAVRASM Software. Proteus Professional 6.5 SP5 Software.

Components used:

AT90S8535 Microcontroller. LED’s

Logic:

13. Setting a logic-high on the LSB of PORTA and logic-low on PORTB. 14. Setting a delay of 1 sec.

Page 22: Embedded System Practical manual (1)

Circuit Diagram:

Page 23: Embedded System Practical manual (1)
Page 24: Embedded System Practical manual (1)
Page 25: Embedded System Practical manual (1)
Page 26: Embedded System Practical manual (1)