Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Circuits

Similar presentations


Presentation on theme: "Introduction to Circuits"— Presentation transcript:

1 Introduction to Circuits
PostPC Computing Introduction to Circuits Prof. Scott Kirkpatrick, HUJI Amnon Dekel, Bezalel 9/19/2018 PostPC 2002

2 Class 5 – Nov 12 2002 HUJI Intro to Electronics Circuits
The “Bread Board” Intro to PIC ICD 9/19/2018 PostPC 2002

3 Intro to Electronics Circuits
Basic Electrical Definitions (borrowed from Tom Igoe’s Site: Electricity is the flow of electrical energy through some conductive material. 9/19/2018 PostPC 2002

4 Intro to Electronics Circuits
Current is a measure of the magnitude of the flow of electrons in a circuit. It is measured in Amperes, or Amps. Many people explain electrical flow by using water flow as an analogy. Following that analogy, current would be how much water (or electricity) is flowing past a certain point. The higher the amperage, the more water (or electricity) is flowing. 9/19/2018 PostPC 2002

5 Intro to Electronics Circuits
Voltage is a measure of the electrical energy of a circuit. It is measured in Volts. In the water analogy, voltage would be the water pressure. Think of a geyser as high voltage, and the shower of a low-rent apartment on the fifth floor of a tenement building as low voltage (unless you're one of those lucky people with good water pressure!). 9/19/2018 PostPC 2002

6 Intro to Electronics Circuits
Resistance is a measure of a material's ability to oppose the flow of electricity. It is measured in Ohms. A sponge in the pipe would act as a resistor, limiting the current (and the voltage) flowing through the pipe 9/19/2018 PostPC 2002

7 Intro to Electronics Circuits
A Circuit is a closed loop containing a source of electrical energy (like a battery) and a load (like a light bulb). Every circuit has to have a load of some sort, All of the electrical energy in a circuit has to get used by the load. The load will convert the electrical energy to some other form of energy. A circuit with no load is called a short circuit. In a short circuit, the power source feeds all of its power through the wires and back to itself, and either the wires melt (if you're lucky), or the battery blows up, or something else disastrous happens. 9/19/2018 PostPC 2002

8 Intro to Electronics Circuits
A Circuit is a closed loop containing a source of electrical energy (like a battery) and a load (like a light bulb). 9/19/2018 PostPC 2002

9 Intro to Electronics Circuits
Flow: Electrical current flows from places of higher potential energy to places of lower potential energy (i.e. from positive to negative). Ground is the place in a circuit with where the potential energy of the electrons is zero. Electrical current flows from places of higher potential energy to places of lower potential energy (i.e. from positive to negative). Electrical current flows from places of higher potential energy to places of lower potential energy (i.e. from positive to negative). 9/19/2018 PostPC 2002

10 Intro to Electronics Circuits
Components Conductors are materials through which electrical current moves freely. Insulators are materials which prevent the flow of electricity. 9/19/2018 PostPC 2002

11 Intro to Electronics Circuits
Resistors resist, but do not totally block, the flow of electricity. They are used to control the flow of current. Current can move either way through a resistor, so it doesn't matter which way they're connected in a circuit. They are symbolized like this: 9/19/2018 PostPC 2002

12 Intro to Electronics Circuits
Capacitors store up electricity while current is flowing into them, then release the energy when the incoming current is removed. Sometimes they are polarized, meaning current can only flow through them in a specific direction, and sometimes they are not. If a capacitor is polarized, it will be marked as such on the diagram. Don't wire a polarized capacitor backwards; it might explode. Capacitors are symbolized like this: 9/19/2018 PostPC 2002

13 Intro to Electronics Circuits
Diodes permit the flow of electricity in one direction, and block it in the other direction. Because of this, they can only be placed in a circuit in one direction. They are symbolized like this: Light-Emitting Diodes (LED's) are special types of diodes which emit light when current flows through them. 9/19/2018 PostPC 2002

14 Intro to Electronics Circuits
switches control the flow of current through a junction in a circuit: transistors and relays are switching devices thermistors change resistance in reaction to varying temperature; photoresistors change resistance in reaction to varying light; flex sensors change resistance in reaction to being bent or flexed; piezoelectric devices create a varying voltage in reaction to slight changes in pressure. 9/19/2018 PostPC 2002

15 Intro to Electronics Circuits
Using the”Bread Board” to build our first circuit What we will be using: Solder-less Prototyping Board Wires Switch LED Resistor 9/19/2018 PostPC 2002

16 Intro to Electronics Circuits
Using the”Bread Board” to build our first circuit 9/19/2018 PostPC 2002

17 Intro to Electronics Circuits
Using the”Bread Board” to build our first circuit 5V 470 9/19/2018 PostPC 2002

18 Intro to PIC The PIC Micro controller (Programmable Interface Controllers) Some of the most popular today Manufactured by Microchip We will work with the PIC16F877 version 368K 20MHz 33 I/O ports 8 8bit ADC’s Synch/asynch hardware serial I/O flash-programmable 9/19/2018 PostPC 2002

19 Intro to PIC 9/19/2018 PostPC 2002

20 Intro to PIC Vdd (Power) - Like every electronic component, you need power and ground. PICs run fine off +5V, and many can run off lower voltages as well. It's best to run your power through a V DC regulator. Vss (Ground) - goes to ground. CLKIN/CLKOUT - unlike higher level processor modules, the PIC has no clock crystal attached, and you have to attach one. A clock crystal and two 22-pF capacitors does the job. 9/19/2018 PostPC 2002

21 Intro to PIC RA0-RA5, RB0-RB7, etc. - These are the input/output pins of the PIC. They are organized in I/O ports, each no more than 8 pins, labeled port A, port B, etc. Some PICs will have only one or two I/O port (16F84 for example), while others may have as many as five (16F877). Some of the I/O port pins will have more than one function. For example, some pins may be attached to the hardware serial port, some may be attached to the ADC's, and so forth. MCLR - Master clear/reset. This is the reset pin. When you take it to ground, the PIC resets itself. Normally you connect it to +5V through a pull-up resistor (a 10K pull-up resistor is fine). 9/19/2018 PostPC 2002

22 Programming the PIC We will be using a integration of 3 environments:
MPLAB IDE: enables project management, project building, link to compilers, and PIC flash programming Editor: Microcode Studio Compiler: PicBasic Pro (you can use a C compiler if you like: check out 9/19/2018 PostPC 2002

23 Programming the PIC Process: Write your program in the editor
Open a new project in MPLAB Point at your program (myfile.bas) Hit F10 (build) Click on Program in the MPLAB program window When getting “waiting for user input” click F9 (run) Click F6 to stop 9/19/2018 PostPC 2002

24 Programming the PIC Example: loop: High PORTB.0 ‘ Turn on LED
Pause ‘ Delay for .5 seconds Low PORTB.0 ‘ Turn off LED Pause ‘ Delay for .5 seconds Goto loop End 9/19/2018 PostPC 2002

25 Programming the PIC 4.3. Variables Label VAR Size{.Modifiers}
Space for each variable is automatically allocated in the microcontroller’s RAM by PBP. Label VAR Size{.Modifiers} Label is any identifier, excluding keywords, as described above. Size is BIT, BYTE or WORD. Some examples of creating variable are: dog var byte cat var bit w0 var word 9/19/2018 PostPC 2002

26 Programming the PIC 4.10. Pins
Pins may be accessed in a number of different ways. The best way to specify a pin for an operation is to simply use its PORT name and bit number: PORTB.1 = 1 ‘ Set PORTB, bit 1 to a 1 To make it easier to remember what a pin is used for, it should be assigned a name using the VAR command. In this manner, the name may then be used in any operation: led var PORTA.0 ‘ Rename PORTA.0 as led High led ‘ Set led (PORTA.0) high 9/19/2018 PostPC 2002

27 Programming the PIC 4.10. Pins
When a PIC micro powers-up, all of the pins are set to input. To use a pin as an output, the pin or port must be set to an output or a command must be used that automatically sets a pin to an output. To set a pin or port to an output (or input), set its TRIS register. Setting a TRIS bit to 0 makes its pin an output. Setting a TRIS bit to 1 makes its pin an input. 9/19/2018 PostPC 2002

28 Programming the PIC TRISA = %00000000 ‘ Or TRISA = 0
Examples TRISA = % ‘ Or TRISA = 0 sets all the PORTA pins to outputs. TRISB = % ‘ Or TRISB = 255 sets all the PORTB pins to inputs. TRISC = % Sets all the even pins on PORTC to outputs, and the odd pins to inputs. Individual bit directions may be set in the same manner. TRISA.0 = 0 sets PORTA, pin 0 to an output. All of the other pin directions on PORTA are unchanged. 9/19/2018 PostPC 2002

29 Packing list Cd with new ppts Breadboard and circuit parts (check)
MPLAB ICD with cable Set up MPLAB with all elements on other machines Test setup Try to fix POT problem 9/19/2018 PostPC 2002


Download ppt "Introduction to Circuits"

Similar presentations


Ads by Google