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

Electrical Engineering

Uploaded by

ANAS RAZI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Electrical Engineering

Uploaded by

ANAS RAZI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

AIR UNIVERSITY

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

EXPERIMENT NO 08

Lab Title: Introduction to MikroC PRO for PIC

Name: Alisha Naqvi Reg. No: 190409

LAB ASSESSMENT:

Excellent Good Average Satisfactory Unsatisfactory


Attributes
(5) (4) (3) (2) (1)
Ability to Conduct
Experiment
Ability to assimilate the
results
Effective use of lab
equipment and follows
the lab safety rules

Total Marks: Obtained Marks:

LAB REPORT ASSESSMENT:


Excellent Good Average Satisfactory Unsatisfactory
Attributes
(5) (4) (3) (2) (1)

Data presentation

Experimental results

Conclusion

Total Marks: Obtained Marks:


Date: Signature:
Task 01:
Read data from PortD and write it on PortB.
Define Port D an input Port and Port B an Output Port.
Connect led bar graph to observe output and connect switches on Port D.

Code:

void main() {
TrisD=0xFF; //Define PortD an input port
TrisB=0; //Define PortB an Output Port
while(1) //Infinite loop
{
LatB=PortD; //Input from the PortD is being written on LATB
}
}
Proteus Simulation:
Task 02:
Write a code to generate the pattern shown below on Led Bar graph.
Code:
void main(void){
TRISB=0x00;
while(1){
unsigned int x,y,z;
y=1;
for(z=1; z<=4; z++){
PORTB=x=y;
y=x*2;
Delay_ms(250);
}
for(z=3; z>= 0; z--){
PORTB=x=y/2;
y=x;
Delay_ms(250);
}
}
}

Proteus Simulation:
Task 03:
Code:
void main(void){
TRISC=0x00;
TRISD0_bit=0;
TRISD1_bit=0;
while(1){
unsigned int x;
Unsigned int z[]=
{0b1000000,0b1111001,0b0100100,0b0110000,0b0011001,0b0010010,0b0000010,0b1
111000,0b0000000,0b0011000};
PORTD.F0=1;
PORTD.F1=1;
for(x=0; x<10; x++){
PORTC=z[x];
Delay_ms(500);
}}}
Proteus Simulation:
Conclusion:
In this lab, we learned about the PIC18F452 and how to program it using C language and
MikroC program. We perform the above tasks and stimulated the result in Proteus software.
We are now familiar with the implementation of counter using PIC.

********

You might also like