0% found this document useful (0 votes)
18 views6 pages

Lab 1 - BMT1113

Uploaded by

Faris Izzat
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 views6 pages

Lab 1 - BMT1113

Uploaded by

Faris Izzat
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/ 6

FACULTY OF ELECTRICAL & AUTOMATION ENGINEERING

TECHNOLOGY

INTRODUCTION TO PROGRAMMING
(BMT 1113)

LAB 1
INTRODUCTION TO BASIC C PROGRAMMING

No. CLO PLO Marks (%)


1 /5
2 /5
Total Marks /10

Update : August 2020 (Luqman, Faizura)


INTRODUCTION TO PROGRAMMING (BMT 1113)

TITTLE: INTRODUCTION TO BASIC TO PROGRAMMING

1.0 OBJECTIVES

i. To learn how to create the basic C Programming


ii. To learn how to use the Flowchart as guideline

2.0 THEORY

Flowchart is an important tool before start producing any kind of program code. It is
use as a guideline for the programmer to write or produce a program code for a certain
process. It contains a few blocks with a different shape which represent different task
for each block.

Flow of Control
Update : August 2020 (Luqman, Faizura) Page 2
INTRODUCTION TO PROGRAMMING (BMT 1113)

3.0 PROCEDURE

3.1 LED Blinking without Flow Chart


i. Open the file ‘Lab 1a’ from the folder ‘LAB 1’ provided to you.
ii. After file opened, it will show a schematic circuit diagram which similar to
Figure 1.

Figure 1: LED circuit diagram

i. Open the C programming Software and write the C programming to blinking


the LED:
sbit led at P1_0_bit;
void main()
{
While(1)
{
led = 1; //ON LED
delay_ms(1000);//DELAY 1S
led = 0; //OFF LED
delay_ms(1000); //DELAY 1S
}
}

ii. Run the program in the Proteus software. Evaluate your finding.

iii. After that, change the value in “delay_ms(1000);” to


“delay_ms(2000);”. Run the program again in Proteus software and see
what happen to the LED. Evaluate your finding.

Update : August 2020 (Luqman, Faizura) Page 3


INTRODUCTION TO PROGRAMMING (BMT 1113)

iv. Write down the program in procedure 3.1 (iii) in the space provided below.

3.2 LED Blinking with Flow Chart


i. Open the file ‘Lab 1b’ from the folder ‘LAB 1’ provided to you.
ii. After file opened, it will show a schematic circuit diagram which similar to
Figure 2.

Figure 2: Two LED circuit diagram

Update : August 2020 (Luqman, Faizura) Page 4


INTRODUCTION TO PROGRAMMING (BMT 1113)

START

Turn ON LED 1

Give a 500ms delay


for LED 1 ON

Turn OFF LED 1

Give a 500ms delay


for LED 1 OFF

Turn ON LED 2

Give a 500ms delay


for LED 2 ON

Turn OFF LED 2

Give a 500ms delay


for LED 2 OFF

END

Figure 3: Flowchart for two LED blinking

iv. Next, open the Programming software. Produce a program code based on
flow chart given in Figure 3 above.

v. Run the program in the Proteus software. Evaluate your finding.

Update : August 2020 (Luqman, Faizura) Page 5


INTRODUCTION TO PROGRAMMING (BMT 1113)

vi. After done testing the program, write down the program in the space provided
below.

4.0 RESULTS AND DISCUSSION


Write all your observation / finding
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________

6.0 CONCLUSION
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________

Update : August 2020 (Luqman, Faizura) Page 6

You might also like