pic microcontroller

Post on 10-Jan-2017

295 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Divya BansalE.C.E Deptt.

EMBEDDED SYSTEM (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

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

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

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);}}

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.

HOUSEHOLD APPLIANCES

AUDIO PLAYERS AIRCRAFTS TELEPHONES CALCULATORS MEDICAL

EQUIPMENT VIDEO GAMES DIGITAL MUSIC

INSTRUMENT

Peripherals interface controller

Developed by Microchip technology

Microcontroller’s

Not microprocessors

Microprocessor system with number of components.

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.

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.

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.

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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.

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.

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

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

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

OUTPUT OF MOVING WORDSOUTPUT OF MOVING WORDS

N N E E

T T

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;

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. }}

0 1

99

-- - - - - - - - - -

UPTO

top related