1 / 24

An introduction to PIC’s for KS3 and KS4. Mr Rooks Hetton School.

An introduction to PIC’s for KS3 and KS4. Mr Rooks Hetton School. Peripheral Interface Controller. PIC. A PIC microcontroller is often described as ‘ a computer on a chip ’. PICs are widely used in every day life.

mfleming
Download Presentation

An introduction to PIC’s for KS3 and KS4. Mr Rooks Hetton School.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An introduction to PIC’s for KS3 and KS4. Mr Rooks Hetton School.

  2. Peripheral Interface Controller. PIC • A PIC microcontroller is often described as ‘ a computer on a chip’. PICs are widely used in every day life. • A modern car for example can use around 40 chips for many purposes such as controlling the management of the engine and controlling the internal temperature of the car. PICs are made by many companies & are available in many different sizes & types.

  3. Peripheral Interface Controller. • This Diagram shows how we can use different inputs to control an output via the PIC microcontroller

  4. Peripheral Interface Controller. • Most PICs are FLASH reprogrammable. • This means that we can download a flowchart to tell the chip how we want it to react to different inputs. If we make a mistake or want the PIC to react differently then we can FLASH the chip as many times as we wish. (100,000 times) This is what a typical flowchart may look like. The PIC we will be using is the PICAXE-08 12F629

  5. Peripheral Interface Controller. • The first step is to build the circuit ! • What the completed circuit should look like. • The circuit uses an LDR or a push switch as INPUTS. • The OUTPUTS are LEDs & a piezo sounder.

  6. Peripheral Interface Controller. Light dependent resistor (LDR) What is an LDR? A Light Dependent Resistor (LDR) is special type of resistor that reacts to changes in light level. The resistance of the LDR changes from about 1,000,000 Ohms in darkness to a few hundred Ohms in bright light

  7. Peripheral Interface Controller. Using switches • A switch is used with a resistor as shown in the diagram. The value of the resistor is not that important, but a 10k resistor is often used. • This arrangement is essential if the device is to work reliably.

  8. Peripheral Interface Controller. Using piezos. A piezo needs a constantly changing ‘on-off’ signal to make a noise. It is very simple to set up. Simply connect the red wire to the microcontroller output pin and the black wire to 0V (ground). (You can use a speaker instead but you will need to include extra components in the circuit)

  9. Peripheral Interface Controller. LEDs - Light Emitting Diodes What is an LED? An LED is a semi-conductor device that gives off light when a current is passed through it. L.E.Ds come in many different sizes, colours and shapes. They need around 20mA of current to light them up, this means they can be driven directly from the chip. This is the arrangement of the LED from the PIC chip.

  10. The cyberpet • Today, you will build a working cyberpet. • This device will have eyes and a voice. • It will respond to touch and even react when you come close. The cyberpet Schematic Diagram

  11. Testing your circuit. Step 1 - Check the solder joints. Check that all the joints are connected to both the pad and the wire, and that the wire is held firmly so that it does not 'wobble' when pulled. Also check that the solder does not accidentally bridge between two pads. This is most likely to happen on the LEDs, the LDR and on the piezo. On the stereo socket the two square pads close together on each side can be joined as they are already joined by a track on the board. However they must not be joined to the central round hole. • Step 2 - Check the components. • Check that the black battery clip wire is in the hole marked 'OV' and the red battery clip wire is in the hole marked 'V+‘ • Check that the PICAXE-08 chip is in the socket correctly, with the dent (showing pin1) closest to the stereo socket. • Check that the flat edge of the LED is connected to the correct hole on the PCB.

  12. Testing your circuit. Step 2 - Check the components. (Cont) Make sure you have not forgotten the wire link over the holes marked PX at the bottom left of the board. Make sure the brass side of the piezo is stuck down with a sticky pad. Check that the socket is correctly soldered, including the middle square pad which is often forgotten by mistake.

  13. Testing your circuit. Step 3 - Connect the battery. Check that the 3 AA batteries are in the battery box the correct way around. Connect the battery box to the battery snap and put the back of your finger on the PICAXE chip. If it starts to get hot remove the battery box immediately because there is a problem – most likely that the chip or the battery snap wires are around the wrong way

  14. Programming - Drawing Flowcharts • Flowcharts are a useful tool that allow programs to be drawn graphically to make them easier to understand. • These flowcharts are then automatically converted ready for download into the PICAXE. Step by Step Guide on Drawing Flowcharts • Start the PIC Logicator 2005 software. • 2) Select PIC > select PIC type. • 3)Select PICAXE-08 • 4) Check that the 'Serial Port' is set to • COM 1 for this work today

  15. Programming - Drawing Flowcharts 5) Set the chip to have 3 outputs – it will automatically set the remaining pins to inputs 6) Draw the flowchart by dragging the correct symbols onto the screen, and then using the mouse to draw arrows between the symbols. 7) Once the flowchart is complete it can be tested on screen then downloaded into the PICAXE by clicking the ‘Yellow lightening bolt’. The first line of programming

  16. Testing your circuit. Download a program to test LED 0. LED 0 can be tested by a simple program like this: Look back at the schematic diagram of the Cyber pet to clarify what is meant by LED 0 It will switch the LED (connected to output pin 0) on and off every second.

  17. Testing your circuit. Test the other LED Repeat the program in step 4, but use high 4 and low 4 instead of high 0 and low 0. This will test the other LED. Note that there is no need to re-write the programme. Just double click on each of the cells then click on the appropriate output number. If you leave o/p 0 at a ‘1’ and change o/p 4 to a ‘1’, both LED’s will flash when the programme is downloaded.

  18. Testing your circuit. Test the piezo The piezo it can be tested by a simple program like this: Drag ‘SOUND’ boxes in. • This program will make the piezo, connected to output pin 2, make 4 different sounds. • The notes are chosen at random and each lasts 1 second

  19. Testing your circuit. If the piezo does not work at all, check: The correct output pin number is being used in the program All the solder joints are good That the wire link over the letters PX is on the board

  20. Testing your circuit. Step 7 - Test the switch This next program will switch ‘output 0’ on for two seconds after the switch has been momentarily pressed. It will then switch ‘output 0’ off again and return to the main loop. • When working, experiment with the switch pressed on for longer periods and observe the effect

  21. Testing your circuit. • Enter the program shown opposite and download to your circuit

  22. Testing your circuit. • Step 8 - Test the LDR This is a simple test which uses the LDR as if it were a switch. In bright light, a high voltage nearly equal to that of the battery will be at the input pin and the microcontroller will ‘see a 1’ When dark, the voltage at the pin drops to nearly 0V and the microcontroller ‘sees a 0’ Enter the program shown below and download it to your circuit.

  23. You have now completed a series of focused practical tasks. These individual tasks have improved your skills in the following areas: Component recognition Circuit board assembly Soldering Testing Programming

More Related