0% found this document useful (0 votes)
96 views14 pages

Question A - Merged

- The document describes Practical Work 2 of the course DEC40053 Embedded System Application. - It involves writing PIC programs for logic and arithmetic operations using PIC16/PIC18F microcontrollers. - The practical work covers various topics - writing code for time delay and I/O functions, implementing logic operations like AND and OR, and arithmetic operations. It also involves drawing circuit diagrams, interfacing with MPLAB, and simulating programs.

Uploaded by

TJ Here
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)
96 views14 pages

Question A - Merged

- The document describes Practical Work 2 of the course DEC40053 Embedded System Application. - It involves writing PIC programs for logic and arithmetic operations using PIC16/PIC18F microcontrollers. - The practical work covers various topics - writing code for time delay and I/O functions, implementing logic operations like AND and OR, and arithmetic operations. It also involves drawing circuit diagrams, interfacing with MPLAB, and simulating programs.

Uploaded by

TJ Here
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/ 14

ELECTRICAL ENGINEERING DEPARTMENT

PRACTICAL WORK 2

DEC40053: EMBEDDED SYSTEM APPLICATION

PROGRAMME: DEP / DTK

CLO 03: Construct and simulate real-time embedded system application


based on PIC16/PIC18F microcontroller effectively. (P4, PLO5)

(CLS 1): Knowledge & Understanding

(CLS3a): Practical skill


__________________________________________________________________________________

Prepared by: Checked by: Verified by:

Date: 22.3.2021 Date: 22.03.2021 Date:


22/3/2021

1
ELECTRICAL ENGINEERING DEPARTMENT
ACADEMIC SESSION: _____________

DEC40053 EMBEDDED SYSTEM APPLICATION

PIC PROGRAMMING FOR LOGIC AND ARITHMETIC


PRACTICAL WORK 2 :
OPERATION
PRACTICAL WORK
DATE :
LECTURER’S NAME:

GROUP NO. :
TOTAL
STUDENT ID & NAME : MARKS
(100%)

(A) SULAIMAN TANJUNG BIN SYAHRIL 17DEP20F2029

MOHAMAD YUSUF BADAWI 17DEP20F2030


(B) MOHAMAD ELHAM DANNY BIN MOHAMAD FAIZAL 17DEP20F2031

DATE SUBMIT : DATE RETURN :

2
Question A

- Write a C program based on the flowchart 2A


- Observation
LED will blinking 10 times.
Figure 1: Sw 1 = 1, Sw 2 = 1 / LED 1 = 1, LED 2 = 1 :
Figure 2: Sw 1 = 0, Sw 2 = 0 / LED 1 = 0, LED 2 = 0 :

Figure 3: Sw1=1, Sw2=1/ LED1=0,LED2=1


Figure 4: Sw1=0,Sw2=1/LED1=1,LED2=0

Observation: If Sw1 = 0, Sw2=1. LED1=1,LED2=0


2C

FLOWCHART
Observation: coding a program SW with delay when led blinking
2d SIMULATION SUCCESS

1
1
1
0
OBSERVATION: WHEN SW1=1,SW2=1 THE LED=1. TURN TO OFF THE LED SW1&SW2 = 0.
Discussion
Based on this practical work, we making the process of writing PIC programming for time
delay and I/O function together with I/O bit manipulation is learn. Also, the process of
creating PIC programming for logic and arithmetic operation. Logic operations are used to
refer to the truth of the whole expression. Three different types of logic operations are used in
this practical which is AND, OR and NOT logic. For procedure 2A, the process of writing for
time delay and I/O function is implemented whereas Practice 2B used logic expressions such
as AND (&&) for both switches. For practice 2C, where there are two switches and two led.
If switch 1 and switch 2 is pushed (LOW) then both led lights does not light up. Whereas, if
Switch 1 or switch 2 is pushed(LOW) then LED 2 will light up. LED 1 will only light up
when never push Switch 1 and Switch 2 (HIGH). For practice 2D, If tank 1 sensor and tank 2
sensor produces a HIGH level of 5V when the water is still more than one-quarter full then
red led will not light up. If Tank 1 sensor or Tank 2 sensor or both sensor produces a LOW
level of 0V then red led will light up.

Conclusion
Depending on the type of microcontroller used, PIC microcontroller I/O ports are named as
PORTA, PORTB, PORTC, and so on. In digital mode, a port pin can be configured as either
input or output. The TRIS registers control the port directions and there are TRIS registers for
each port, namely TRISA, TRISB, TRISC, and so on. Clearing a TRIS register bit to 0 sets
the corresponding port bit to output mode. Similarly, setting a TRIS register bit to 1 sets the
corresponding port bit to input mode.Ports can be accessed either as a single 8-bit register or
as individual bits. Bits of an I/O port can be accessed using the key word bits and then
specifying the required port bit name. In the following example, variable P2 is loaded with bit
2 of PORTB : P2 = PORTBbits.RB2. The arithmetic operations are addition (ADD),
subtraction (SUB), multiplication (MUL), division(DIV) and logical operations are AND,
OR, NOT, XOR, and so on. Arithmetic and logic operation group instructions are used for
performing all arithmetic operations and logic operations. By using these types of
instructions, the PIC chip can easily perform all arithmetic and logic operations inside the
microcontroller(PIC)
PW2: PIC PROGRAMMING FOR LOGIC AND ARITHMETIC OPERATION
MATRIX NUMBER NAME

A
SULAIMAN TANJUNG BIN SYAHRIL A B
17DEP20F2029
17DEP20F2030 MOHAMAD YUSUF BADAWI
B MOHAMAD ELHAM DANNY BIN MOHAMAD FAIZAL
17DEP20F2031
Course Learning
Outcomes(CLO)/ Skills / Very Poor Satisfactory Very Good
Learning Domain
Circuit Marks
Aspects
Cluster (CLS) 1 2 3
Coding: student Able to write and
Able to write and
able to write Faces difficulty to compile the codes
compile the codes /3 /3
and compile the write the codes without any error and
with assistance.
codes assistance
Good to draw the
Draw circuit: Has difficulty to
circuit input and Excellent to draw the
student able to draw the circuit
Circuit output pin circuit input and /3 /3
draw the PIC input and output
moderately with output pin
A circuit pin
minimum assistance.
Interfacing:
Able to interface the Able to interface the
student able to Has difficulty to
MPLAB & simulation MPLAB & simulation
Interface interface the
circuit and show the circuit and show the /3 /3
MPLAB & MPLAB &
output with output without any
simulation simulation circuit
assistance. error and assistance
circuit

/9 /9

CLO 03:
Coding: student Able to write and
Construct and Able to write and
able to write Faces difficulty to compile the codes
simulate real- compile the codes /3 /3
and compile the write the codes without any error and
time embedded with assistance.
codes assistance
system Good to draw the
application Draw circuit: Has difficulty to
circuit input and Excellent to draw the
based on student able to draw the circuit
output pin circuit input and /3 /3
PIC16/PIC18F Circuit draw the PIC input and output
moderately with output pin
B circuit pin
microcontroller minimum assistance.
effectively. (P4, Interfacing:
PLO5. Able to interface the Able to interface the
student able to Has difficulty to
MPLAB & simulation MPLAB & simulation
Interface interface the
circuit and show the circuit and show the /3 /3
CLS 1: MPLAB & MPLAB &
output with output without any
Knowledge & simulation simulation circuit
assistance. error and assistance
Understanding circuit

CLS3a: Practical /9 /9
skill
Coding: student Able to write and
Able to write and
able to write Faces difficulty to compile the codes
compile the codes /3 /3
and compile the write the codes without any error and
with assistance.
codes assistance
Good to draw the
Draw circuit: Has difficulty to
circuit input and Excellent to draw the
student able to draw the circuit
output pin circuit input and /3 /3
draw the PIC input and output
moderately with output pin
circuit pin
minimum assistance.
Circuit
Interfacing:
C Able to interface the Able to interface the
student able to Has difficulty to
MPLAB & simulation MPLAB & simulation
Interface interface the
circuit and show the circuit and show the /3 /3
MPLAB & MPLAB &
output with output without any
simulation simulation circuit
assistance. error and assistance
circuit

/9 /9

7
PW2: PIC PROGRAMMING FOR LOGIC AND ARITHMETIC OPERATION
MATRIX NUMBER NAME

A 17DEP20F2029 SULAIMAN TANJUNG BIN SYAHRIL A B

B 17DEP20F2030 MOHAMAD YUSUF BADAWI


17DEP20F2031 MOHAMAD ELHAM DANNY BIN MOHAMAD FAIZAL
Course Learning
Outcomes(CLO)/ Skills / Very Poor Satisfactory Very Good
Learning Domain
Circuit Marks
Aspects
Cluster (CLS) 1 2 3
Coding: student Able to write and
Able to write and
able to write Faces difficulty to compile the codes
compile the codes /3 /3
and compile the write the codes without any error and
with assistance.
CLO 03: codes assistance
Construct and Good to draw the
Draw circuit: Has difficulty to
simulate real- circuit input and Excellent to draw the
student able to draw the circuit
time embedded Circuit output pin circuit input and /3 /3
draw the PIC input and output
moderately with output pin
system D circuit pin
minimum assistance.
application Interfacing:
based on Able to interface the Able to interface the
student able to Has difficulty to
PIC16/PIC18F MPLAB & simulation MPLAB & simulation
Interface interface the
circuit and show the circuit and show the /3 /3
microcontroller MPLAB & MPLAB &
output with output without any
effectively. (P4, simulation simulation circuit
assistance. error and assistance
PLO5. circuit

/9 /9

1. PRACTICAL SKILLS PSYCHOMOTOR ASSESMENT - (80%)

Circuit Circuit Circuit Circuit


NO. STUDENT’S NAME Total: 70%
A B C D

SULAIMAN TANJUNG BIN SYAHRIL


A /9 /9 /9 /9 /36 /70

B
MOHAMAD YUSUF BADAWI
/9 /9 /9 /9 /36 /70
MOHAMAD ELHAM DANNY BIN MOHAMAD
FAIZA

2. PRACTICAL WORK COGNITIVE ASSESSMENT - (REPORT 20%)

RESULT DISCUSSION
Logical Logical CONCLUSION
Coding Flowchart Circuit For If Else 30%
operation operator
5 5 5 2.5 2.5 2.5 2.5 5

You might also like