pic microcontroller

32
Divya Bansal E.C.E Deptt. EMBEDDED SYSTEM (PIC MICROCONTROLLER)

Upload: divya-bansal

Post on 10-Jan-2017

295 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: PIC Microcontroller

Divya BansalE.C.E Deptt.

EMBEDDED SYSTEM (PIC

MICROCONTROLLER)

Page 2: PIC Microcontroller

Embedded System Microcontroller v/s microprocessor Tina Pro Led Interfacing Led Blinking Led blinking Turn By Turn Led Running X-Pattern Digital Counting

Page 3: PIC Microcontroller

Pin Programming Switching Pattern For And If Loop Lcd Interfacing Name Blinking Name Running Moving Words Counting using ASCII Codes Digital Clock

Page 4: PIC Microcontroller

Temperature Sensor DC Motor Interfacing Stepper Motor Interfacing Relay Interfacing Seven Segment Display Display Single Digit Display Different Digits

Page 5: PIC Microcontroller

Embedded system is one that has computer hardware with software embedded in it as one of its important components. Its software embeds on ROM. It does not need secondary memories as in a computer.

Void main{Trisb=0x00;while(1){portb=0xff

delay_ms(100);portb=0x00;delay_ms(100);}}

Page 6: PIC Microcontroller

SYSTEM EXAMPLES

It is a time display system.

All needles move clockwise only.

A thin needle rotate every second.

A long needle rotate every minute.

A short needle rotate every hours.

All needles return to original position after 12 hours.

Page 7: PIC Microcontroller

HOUSEHOLD APPLIANCES

AUDIO PLAYERS AIRCRAFTS TELEPHONES CALCULATORS MEDICAL

EQUIPMENT VIDEO GAMES DIGITAL MUSIC

INSTRUMENT

Page 8: PIC Microcontroller

Peripherals interface controller

Developed by Microchip technology

Microcontroller’s

Not microprocessors

Microprocessor system with number of components.

Page 9: PIC Microcontroller

A microprocessor is a programmable digital electronic component that incorporates the function of CPU on a single semi conducting IC. Microprocessor is of 8-bit, 16-bit, 32-bit, 64-bit.

Page 10: PIC Microcontroller

A tiny computer that programmable to run a program.

Serves as a bridge between the physical world and computer world.

Interact with the “real world” through transducers such as sensors, motors lights etc,

Four functions: Input, Process, Output then communicate.

Page 11: PIC Microcontroller

It is a general purpose computer.

It has 1 or 2 instructions.

IT contain CPU, memory addressing ckts. And interrupt handling ckts.

It has many opcodes for moving data from external memory to CPU.

It is special purpose digital computer.

It will have many.

It contain all these as well as timers, parallel and serial i/o and internal RAM and ROM.

It has 1 or 2.

Page 12: PIC Microcontroller

Tina pro is a affordable software for elect. Students to simulate circuits. In this we have to pull and place components. It is advance technology for engineer to test the circuit with implementing into the pcb, using pcb may cause several damage on electronics equipment

Page 13: PIC Microcontroller

Here we connect the led with npn transistor at the collector side and ground the emitter terminal. We connect the supply or battery at collector terminal, it is of 5v. We connect the resistance of 220ohm at anode so that more current will not be pass and we select 220 because of led internal resistance.

Page 14: PIC Microcontroller

Here we connect the led with npn transistor at the

collector side when we close the switch and

supply will given then led will

glow like shown with arrows.

Page 15: PIC Microcontroller

Here we connect the led with pnp

transistor at the emitter side and

ground the collector terminal. We connect the supply or battery at emitter terminal, it is of 5v. We connect

the resistance of 220ohm at cathode so that more current will

not be pass and we select 220 because of

led internal resistance.

Page 16: PIC Microcontroller

Here we connect the

led with pnp transistor at the emitter

side when we close the

switch and supply will

given then led will glow like shown with

arrows.

Page 17: PIC Microcontroller

Here we use two npn and 1 switch. We use a battery of 5v and ammeter so that we check the current flow through the circuit. We connect the bulb at the load or we can say that between collector of first npn and second npn transistor. When we close the switch and supply is given to the circuit then bulb will glow.

Page 18: PIC Microcontroller

Here we connect two

npn transistor back to back, when we close the switch and

supply will given to the circuit then

bulb will glow like shown with

arrows.

Page 19: PIC Microcontroller

Here we use npn and pnp. We use a battery of 5v . We connect the bulb at the load or we can say that between

collector of npn and emitter of pnp transistor. When we close the switch and

supply is given to the circuit then bulb will glow.

Page 20: PIC Microcontroller

Here we use npn and pnp. We use a battery of 5v . We connect the bulb at the load or we can say that between

collector of npn and emitter of pnp transistor. When we close the switch and

supply is given to the circuit then bulb will glow,

shown with arrow.

Page 21: PIC Microcontroller

Here we use 4 npn. We use a battery of 5v.

We connect the motor between 4

npn transistor. We

use 4 switches at the base of

each transistor or we can say that we use

transistor as a switch.

Page 22: PIC Microcontroller

When we close s1, s3 switch the motor rotates clockwise and s2, s4 close, then motor rotates anticlockwise.

Page 23: PIC Microcontroller

Relay is a electro mechanical switch. Here we use SPOR here we connect the bulb and battery to give the supply to the circuit and ammeter. It is used to check that how much current is flow through the circuit.

Page 24: PIC Microcontroller

Mikro c is a powerful feature rich development tool for PIC. It is designed to provide the programmer with easiest possible solution for developing applications for embedded system, without compromising performance or control.

Page 25: PIC Microcontroller

1. void main()2. {3. int i,j,k;4. trisb=0x00;5. lcd_init(&portb);6. lcd_cmd(lcd_clear);7.

lcd_cmd(lcd_cursor_off);8. while(1)9. {10. for(i=16;i>=1;i--)11. { 12. Lcd_chr(1,i,'N');

PROGRAM FOR MOVING WORDSPROGRAM FOR MOVING WORDS

Page 26: PIC Microcontroller

13. delay_ms(100);14. lcd_chr(1,i+1,' ');15. delay_ms(100);16. }17. for(j=16;j>=2;j--)18. {19. lcd_chr(1,j,'E');20. delay_ms(100);21. lcd_chr(1,j+1,' ');22. delay_ms(100);23. }

PROGRAM FOR MOVING WORDSPROGRAM FOR MOVING WORDS

Page 27: PIC Microcontroller

24. for(k=16;k>=3;k--)25. {26. lcd_chr(1,k,'T');27. delay_ms(100);28. {29. lcd_chr(1,k,'T');30. delay_ms(100);31. lcd_chr(1,k+1,' ');32. delay_ms(100);33. }34. }35. }

PROGRAM FOR MOVING WORDSPROGRAM FOR MOVING WORDS

Page 28: PIC Microcontroller

OUTPUT OF MOVING WORDSOUTPUT OF MOVING WORDS

N N E E

T T

Page 29: PIC Microcontroller

1. Void ascii(unsigned char d)

2. {3. Unsigned char t;4. T=d/10;5. Lcd_chr_cp(t+48);6. T=d%10;7. Lcd_chr_cp(t+48);8. }9. Void main()10. {11. int k;12.Trisb=0x00;

Page 30: PIC Microcontroller

13. Lcd_init(&portb);14. lcd_cmd(lcd_clear);15.

lcd_cmd(lcd_cursor_off);16. while(1)17. {18. for(k=0;k<=99;k++)19. {20. lcd_cmd(0x85);21. ascii(k);22. delay_ms(300);23. }24. }}

Page 31: PIC Microcontroller

0 1

99

-- - - - - - - - - -

UPTO

Page 32: PIC Microcontroller