+ All Categories
Home > Documents > ES Final Doc

ES Final Doc

Date post: 26-Nov-2015
Category:
Upload: bilal-ahmed
View: 50 times
Download: 4 times
Share this document with a friend
Description:
Msc-cs journal Embedded Systems
Popular Tags:
35
Practical 1 Toggle Port LED 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. Code: #include <90s8535.h> #include <delay.h> void main(void) { DDRA=0xff; PORTA=0xff; DDRB=0xff; PORTB=0x00; //Unmasking the interrupt #asm("sei"); while (1) { delay_ms(2000); PORTA=PORTA^0xff; PORTB=PORTB^0xff; } }
Transcript

Practical 1

Toggle Port LED

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.

Code:

#include #include

void main(void){DDRA=0xff;PORTA=0xff;DDRB=0xff;PORTB=0x00;//Unmasking the interrupt#asm("sei");while (1){ delay_ms(2000); PORTA=PORTA^0xff;PORTB=PORTB^0xff; }}

Output:

Practical 2

Simulate Binary Counter at Port

Write a program in Assembly/C programming language to simulate binary counter on LEDs. Draw appropriate circuit diagram to demonstrate the above problem.

Code:

#include #include

//Global variable unsigned char led_status=0x01;

void main(void){DDRB=0xff;PORTB=led_status;//Unmasking the interrupt#asm("sei");while (1){ PORTB=led_status; if(led_status==0x80)led_status=0x01;else led_status


Recommended