Uploaded by Hassan Jadran

LAB 6

advertisement
LAB TASK 6
LAB 6
Lab Tasks 1.
Three different temperature sensors are connected to RB1, RB2 and RB3. If the temperature
observed at any of the sensors exceeds the specific threshold, an alarm alert is generated by a
Green LED connected at RC4. Implement the above task with microcontroller PIC18 F452 in
Proteus. Use Switches with RB1, RB2 and RB3 to simulate the effect of sensors.
CODE:
#INCLUDE <P18F452.INC>
LIST P=PIC18F452, F=INHX32, N=0, ST=OFF, R=HEX
config OSC=HS, OSCS=OFF, WDT=OFF, BORV=45, PWRT=ON, BOR=ON, DEBUG=OFF, LVP=OFF,
STVR=OFF
ORG 0X2A
BCF TRISC,4
BCF PORTC,4
AGAIN
BTFSC PORTB,1
BSF PORTC,4
BTFSC PORTB,2
BSF PORTC,4
BTFSC PORTB,3
BSF PORTC,4
BRA go
BSF PORTC,4
BRA AGAIN
go
BCF PORTC,4
BRA AGAIN
END
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
SCREENSHORTS:
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
PROTEUS SIMULATION:
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
TASK 2:
2. Modify the above program by connecting two extra LEDs Blue and RED, with RC5 and
RC6. Now three will be following alarm updates. a) Turn on Green LED if any one of the
sensors sends an alarm. b) Turn on Blue LED if any two of the sensors sends an alarm. c)
Turn on RED LED if all of the sensors sends an alarm.
CODE:
#include<P18F452.INC>
LIST P=PIC18F452, F=INHX32, N=0, ST=OFF, R=HEX
config OSC=HS, OSCS=OFF, WDT=OFF, BORV=45, PWRT=ON, BOR=ON, DEBUG=OFF, LVP=OFF,
STVR=OFF
ORG 0X2A
CLRF TRISC
CLRF PORTC
XYZ MOVLW 07H
MOVWF 00H
ANDWF PORTB,W
XORWF 00H
BZ ON
BNZ go
ON BCF PORTC,4
BRA XYZ
go MOVLW 03H
MOVWF 03H
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
MOVLW 05H
MOVWF 05H
MOVLW 06H
MOVWF 06H
MOVLW 07H
MOVWF 00H
ANDWF PORTB,W
XORWF 03H
BZ CHECK
XORWF 05H
BZ CHECK
XORWF 06H
BZ CHECK
BRA GO1
CHECK BCF PORTC,4
BSF PORTC,5
BRA XYZ
GO1 MOVLW 00H
MOVWF 01H
IORWF PORTB,W
XORWF 01H
BZ EXIT
BNZ ON1
ON1 BSF PORTC,6
EXIT BCF PORTC,5
BCF PORTC,6
BCF PORTC,4
BRA XYZ
END
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
SCREENSHORTS:
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
OUTPUT:
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
PROTEUS SIMULATION:
Turn on Blue LED if any two of the sensors sends an alarm.
Turn on Green LED if any one of the sensors sends an alarm.
Turn on RED LED if all of the sensors sends an alarm.
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
LaboratoryAssessment
Criteria
Psychomotor(evaluat
ed
duringtheexperiment
)
Allocated
Marks
LearningLevel
Poor
Good
VeryG
ood
Excellent
40%
50-60%
70-80%
90-100%
Obtained
Marks(P)
60%
LearningLevel
HASSAN ABBAS
FA19-EEE-038
LAB TASK 6
Criteria
Affective
(Evaluated
duringtheLab)
Criteria
Cognitive(evaluate
d
onreportsubmission
)
Allocated
Marks
Poor
Good
VeryG
ood
Excellent
40%
50-60%
70-80%
90-100%
Obtained
Marks(A
)
10%
Allocated
Marks
LearningLevel
Poor
Good
VeryG
ood
Excellent
40%
50-60%
70-80%
90-100%
Obtained
Marks(C
)
30%
ObtainedMarks= (0.6×P)+(0.1×A)+(0.3×C)=
: TotalMarks:
CourseInstructor:
HASSAN ABBAS
FA19-EEE-038
Download