0% found this document useful (0 votes)
16 views7 pages

Lab 2 - BMT 1113

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)
16 views7 pages

Lab 2 - BMT 1113

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/ 7

FACULTY OF ELECTRICAL & AUTOMATION ENGINEERING

TECHNOLOGY

INTRODUCTION TO PROGRAMMING
(BMT 1113)

LAB 2
SEQUENCE PROGRAMMING

No. CLO PLO Marks (%)


1 /5
2 /5
Total Marks /10

Update : August 2020(Luqman, Faizura)


INTRODUCTION TO PROGRAMMING (BMT 1113)

TITTLE: SEQUENCE PROGRAMMING

1.0 OBJECTIVES

i. To learn how to create the Sequence Programming


ii. To learn how to use the Flowchart as guideline in programming

2.0 THEORY

2.1 SEQUENCE STATEMENT

Sequential: Default mode, sequential execution of code statements (one line


after another) – like following a recipe.

3.0 PROCEDURE

3.1 LED Blinking using sequence


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

Update : August 2020 (Luqman, Faizura) Page 2


INTRODUCTION TO PROGRAMMING (BMT 1113)

Figure 1: LED circuit diagram

Table 1: LED Sequence

LED LED LED LED LED LED LED LED


8 7 6 5 4 3 2 1

Sequence 1

Sequence 2

Sequence 3

Sequence 4

Sequence 5

Sequence 6

Sequence 7

Sequence 8

iii. Draw a flowchart to blink the LED in sequence according to the Table 1
provided.
iv. Open the Programming software. Write the program LED blinking below and
save the file.
sbit led1 at P1_0_bit;
sbit led2 at P1_1_bit;
sbit led3 at P1_2_bit;
sbit led4 at P1_3_bit;
sbit led5 at P1_4_bit;

Update : August 2020 (Luqman, Faizura) Page 3


INTRODUCTION TO PROGRAMMING (BMT 1113)
sbit led6 at P1_5_bit;
sbit led7 at P1_6_bit;
sbit led8 at P1_7_bit;

void main()
{
{
Led1 = 1;
delay_ms(200);
led1 = 0;
delay_ms(200);

Led2 = 1;
delay_ms(200);
led2 = 0;
delay_ms(200);

Led3 = 1;
delay_ms(200);
led3 = 0;
delay_ms(200);

Led4 = 1;
delay_ms(200);
led4 = 0;
delay_ms(200);

Led5 = 1;
delay_ms(200);
led5 = 0;
delay_ms(200);

Led6 = 1;
delay_ms(200);
led6 = 0;
delay_ms(200);

Led7 = 1;
delay_ms(200);
led7 = 0;
delay_ms(200);

Led8 = 1;
delay_ms(200);
led8 = 0;
delay_ms(200);

}
}

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

Update : August 2020 (Luqman, Faizura) Page 4


INTRODUCTION TO PROGRAMMING (BMT 1113)

3.2 LED Blinking continuously with sequence


i. Use same schematic diagram provided to you ‘Lab 2a’.
ii. Modify the program in procedure 3.1 (iv) to blink the LED continuously in
sequence by adding ‘while (1)’ statement after ‘void main()’ as following:

void main()
{
While(1)
{
………………………………

iii. Run the program in the Proteus software. Differentiate the results in
Procedure 3.2 (ii) and Procedure 3.1 (iv). Evaluate your finding.
iv. After done testing the program, write down the complete program in
procedure 3.2(ii) and draw the flowchart in the space provided below (attach
another paper if the space provided is not enough).

3.3 LED Blinking using multiple sequence (Pattern)

i. Use same schematic diagram provided to you ‘Lab 2a’.


ii. Draw a flow chart to blink the LED continuously in sequence with different
patterns of LED blinking as following:
Update : August 2020 (Luqman, Faizura) Page 5
INTRODUCTION TO PROGRAMMING (BMT 1113)

3.31 Two LED sequences blinking continuously

Table 2: LED Sequence 1


LED LED LED LED LED LED LED LED
8 7 6 5 4 3 2 1
Sequence 1

Sequence 2

Sequence 3

Sequence 4

Table 3: LED Sequence 2


LED LED LED LED LED LED LED LED
8 7 6 5 4 3 2 1
Sequence 1

Sequence 2

Sequence 3

Sequence 4

3.32 Four LED sequences blinking continuously

Table 4: LED Sequence 4


LED LED LED LED LED LED LED LED
8 7 6 5 4 3 2 1
Sequence 1

Sequence 2

Table 4: LED Sequence 4


LED LED LED LED LED LED LED LED
8 7 6 5 4 3 2 1
Sequence 1

Sequence 2

iii. Next, open the Programming software. Produce a program code based on
flow chart at procedure 3.3(ii) and save the files in different name.
iv. Run the program in the Proteus software. Evaluate your finding.

Update : August 2020 (Luqman, Faizura) Page 6


INTRODUCTION TO PROGRAMMING (BMT 1113)

v. After done testing the program, write down the program in the space provided
below (attach another paper if the space provided is not enough).

4.0 RESULTS AND DISCUSSION


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

6.0 CONCLUSION
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________

Update : August 2020 (Luqman, Faizura) Page 7

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy