Home

Full manual - Physics Department

image

Contents

1. Geeeo coeeoo 9 b 15V Gnd OV 5V Figure A 1 Layout of common connections on the breadboards The banana plugs and the BNC connectors are used to connect the components on the bread board to the external devices such as meters scopes and function generators You should not connect wires directly between the breadboard and an external device it is unsafe The proper breadboarding technique is illustrated in Fig A 2 Aa noobooodos Lsssd A Figure A 2 The proper breadboarding technique 53 NAME PRINT STUDENT ID LAB DATE GRADE Appendix B Resistor Colour Code W Ist 2nd rd 4th J BANDS Second Band Third Band Silver is 10 tolerance Fourth Band Gold is 5 tolerance No band is 20 tolerance For example the resistance of a resistor whose bands are red red red silver is 22 x 10 2 2kN 10 54 NAME PRINT STUDENT ID LAB DATE GRADE Appendix C Plotting with physica An integral part of every lab is an analysis of the results and it is best done with the help of a scientific visualization plotting fitting computer program There is a large number of such programs for different computing platforms If you are comfortable using one such package already you may use the software you already know However bear in mind that e the software must be able to perform multi paramete
2. TT T S EEE retlw 00001000 Fete ees Es OM Bas a e aeea Tar hat The bits of a port are generally assigned various functions so you must take care to modify only the pertinent bits when using byte size instructions This masking process requires reading the current port value modifying only specific bits then writing back the data to the port Bit manipulation instructions are not useful when the bit to be modified varies as in the selection of the digit to be displayed 8 4 Interrupts You will note that depending on the code that you added the above program will initialize the digit values and display them indefinitely or you will have implemented a loop that modifies the digit variables and calls the Scan7seg subroutine In the first case the PIC is fully occupied scanning the display and can perform no other function in the second case the refresh rate is determined by repeated calls to a subroutine The ideal way to execute a periodic sequence of events is to use an interrupt A hardware timer on the PIC interrupts the program flow every 5ms and executes a call to a user interrupt service routine ISR The ISR code runs in the background independently of the user program You can with an ISR update the display variables or wait for input while the Scan7seg ISR scans the display at a constant rate Note that the execution time of the ISR must be less than the time between interrupts or your program will hang With this in mind your ISR i
3. Ve Oe Os Oe Os Oy Oe Oy for this lab The reason for choosing such a strange value is to be able to generate oscilla tions of much lower frequencies by using multi stage divide by two circuits It just so happens bo Po reset Os Og Ow Voo that 4096 2 and all we need is to build 12 N O OD O N o hol Iul el hzl h4 hsl lie divide by two counters in a row to get to 1 kHz for example ail A convenient device is a 14 stage ripple carry 15V binary counter 4060 Depending on which out n AN put one chooses one can obtain from a divide MQ by 2 to a divide by 2 Thus with a single IC 1kQ we can generate frequencies as low as 250 Hz 4 096MHz a convenient frequency if one wishes to build a small timer circuit with a time resolution of about 0 002s o Note how the suggested component values 59pF Z 10pF are selected to ensure a reliable 50 duty cycle oscillation by keeping the crystal at the mid point of the voltage divider formed by the 1 kQ resistor and the 39 pF capacitor i e how for Figure 4 2 Crystal based digital oscillator w 2r x 4 096 MHz Zr 1 al Zc 39 pF Also note that since the oscillator components are not directly connected to the chip power supply the oscillator frequency is not affected by variations in the power supply voltage 4 3 REVIEW OPERATIONAL AMPLIFIERS 17 T Download a copy of the 4060 data sheet and review the inter
4. interface could be adapted to display in real time the action of a chaotic two pendulum magnetic toy or to the monitoring control of a model Foucault pendulum For the latter useful pointers are e Richard Crane s article in the References section on the PHYS 2P32 website e http en wikipedia org wiki Foucault_pendulum e http www iop org EJ article 0031 9120 19 6 412 pev19i6p294 pdf e http www sas org E Bulletin 2002 04 26 handsOnPhys body html NAME PRINT STUDENT ID LAB DATE GRADE Appendix A Breadboards Breadboards permit quick solderless connections between the components of an electronic circuit As indicated in the diagram the holes of the breadboard are split into parallel sets of five 5 Within each hole is a metal clip to hold a wire and the clips in each set are connected together A Extended Rows 4 o0000 o0o000 00000 c0000 o0000 pe oooo o oo0000 oo0o000 oo0oo0o0o0 oo0oo0o0o0 0000 0 Set of five connectors ooo0oo0oo0 ooo0oo0o0 O00 0O o0000 00000 oo0o00 flocooe ooo0oo0o0 coocchoooce ooo0oo0o0 ooo0oo0o0 if Extended Rows B Two wires can be connected electrically by placing their ends into two holes belonging to the same set of 5 holes The connector sets in the outside rows have been joined together to form four 4 extended rows Some breadboards do not have connections at points A and B resulting in eight half rows These outside rows are o
5. A completely assembled PICLab project board 7 4 PICLab basic functionality tests Before putting your project board to a practical use you must verify that all of the board s com ponents are functioning as expected To begin with always establish that the correct voltage is present and distributed throughout the board D Have the instructor check your board before you perform the following tests 1 Connect a USB cable from the board to the host computer The LED should light up If it does not the LED may have been inserted backwards With a voltmeter verify that there is 5V DC at the Vdd pin of the PIC expansion bus D Test the reset circuit This circuit sets the voltage at the MCLR pin of the controller A low voltage at this pin resets the processor while a level of 5V puts the processor in run mode With the Reset switch released there should be 5V DC present at the MCLR pin of JP8 Press the Reset switch SW1 The voltage should drop to OV Release the switch to return the reset line to 5V Q If the above tests have been successful remove power from the project board Ground yourself by touching the metal case of an instrument then install the PIC microcontroller chip on the board Be sure to properly orient the chip in the IC socket Without touching the pins carefully line up the PIC chip with the socket so that all the pins are lined up with the socket below Gently and evenly press the chip into the socket being sure tha
6. BS 44 8 5 Analog to digital conversion lt gt Bah 9 Serato Woke dere ae we Node De eS ae dee Be 45 8 6 Utility subroutines and data output 4 63 36s e we eee ee ee ee he Ss 46 9 PICLab data acquisition project 47 9 1 A PID temperature controller 20 8 aa a ot Tie hye Stee ee Eilts 48 9 2 An ultrasonic pinger oaoa a 48 9 3 A chaotic dripping tap rsh week es amp Beek O EA os RAR 2 E A E 48 9 4 A universal digital knob aoaaa aaa a 48 9 5 An LCD bar graph aaa a 49 9 6 A joystick controlled servomotor aon 4 Glee ace GD 6 ee ame a A ae 49 9 7 Decoding an infrared remote control 2 0 a a 49 9 8 A PIC based mouse controller fuck aig aaa w alee ae dag ESS ald 50 A Breadboards 51 B Resistor Colour Code 54 C Plotting with physica 55 Plotting with physica 55 Preface Introduction Mastering Electronics is not an easy task While many concepts are straightforward their ap plication to a real world device are often non trivial Part of the difficulty is that in addition to new concepts one often has to learn new numerical and algebraic tools that enable us to predict the values of various components to use to select their settings and operating points for optimum performance Putting it all together can be quite daunting In this laboratory you will use a variety of tools to achieve just that e hands on experiments where you will assemble real circuits using real components meters wires and devic
7. T Repeat the above procedure to mount the 40 pin socket for the seven segment displays U1 and U2 Here we are using a socket to allow for the displays to be removable Orient this IC socket with the index mark next to pin 1 of U1 1 Locate the 10 pin header J3 required for in circuit serial programming The location is labeled ICSP Program Insert the shorter end of the header strip flush with the board and solder it in place The FT232BM USB interface chip has been pre soldered to the board Typically for proper installation a surface mount component requires a fine tipped soldering iron and very thin solder as well as the aid of a magnifier Install the other USB related components the resistors R11 R12 R15 and R19 then the capacitors C7 and C10 C14 and finally the 6 MHz crystal Y2 making sure that the metal case does not contact the pads of C10 oe Install the silver USB B connector by gently pressing the jack into the mounting holes while being careful to make sure that the four small signal wires are properly inserted and protruding from the other side of the board Carefully check over the entire board You can use the illuminated magnifier to verify that all of the solder joints are of good quality and that the components are installed at the correct locations and in the proper orientation Fig 7 2 shows you what your completed PICLab project board should look like 7 4 PICLAB BASIC FUNCTIONALITY TESTS 35 Figure 7 2
8. When soldering a two lead component such as a resistor or diode insert the component into the PC board so that it rests flush with the board s surface then slightly bend the leads outward where they meet the board Solder both leads and when cooled snip off the excess lead where it meets the solder joint 7 3 ASSEMBLY OF A PICLAB PROJECT BOARD 33 e When soldering a component with several connections such as an IC socket insert the com ponent flush with the board and hold it in place as you solder the corner pins to the board If the socket is not properly seated apply some pressure to the raised region and heat the solder joint After you are satisfied that the part is flush with the board solder the remaining pins 7 3 Assembly of a PICLab project board The parts IDs are laid out on the board as text on paper with the lowest index at the top left corner and ID numbers progressing in rows to the lower right corner of the board To attach the various components to the printed circuit board adhere to the following assembly sequence Check off each step as it is completed Note that many components are polarized and require to be placed on the board in a particular orientation Follow the philosophy of checking component placement twice and soldering once The removal and replacement of improperly installed components can be a tedious time consuming process and if improperly carried out can lead to board damage Note before proceeding wi
9. active high 3 Output R High when Trigger lt V 3 Low when Threshold gt 2 3 V3 555 astable Trigger 2 Transistor conducts D RAPE R when Q is high 7 c Ice 50mA max _ZE Figure 4 3 555 bistable oscillator showing internal components NAME PRINT STUDENT ID LAB DATE GRADE Experiment 5 Building a counter This experiment explicitly involves several stages of a single project from a conceptual design to computer based simulation to physical implementation and debugging The project a decimal counter Note that some of the necessary data is not provided on the diagrams of this experiment it is essential that you consult the appropriate datasheets directly 5 1 Building a device stage by stage Counting physical events is a common requirement that illustrates well many of the essential ele ments of a successful real life application of electronic circuits It involves the physical stage the closing of a pair of mechanical contacts a change in the illumunation of a photosensor a voltage drop that activates a solid state relay or a transistor Here the issues of imperfections of efficient signal transduction from the physical into the electronic realm and of signal conditioning and noise resilience play an important role the signal processing stage where the now electronic logical signal is processed tallied up analyzed or compared with a desired reference condition the display and feedb
10. bit 4 7 bit 3 bit 2 bit 1 bit 0 shift counter Done TI LLL tvee O O o e i Kd Ai o o T if T t e b D Q D n DAF Q i gt Q gt q aa ea aa yee aa oa aa aa UL Ly Ud I a A DA a a A ji a A DA DA a A j di e ad d d B DHr Emt 3 J Ya 8 ee lt a Y t 3 a Ya B e Ya 8 S Y 8 a Yu B Ea Yu T RRRA w ah i te I i fs gi Ai Qe eS A re clock reset multiplier multiplicand zi Figure 6 3 A 4x4 bit shift add multiplier The product is stored in the accumulator Fig 6 3 shows an implementation of a 4x4 multiplier that uses a shift add algorithm The circuit is quite complex and we need to spend some time understanding its operation Let us begin by considering the operation of the circuit on reset With a logic zero on the reset line the accumulator and shift counter latches are cleared and the clock circuit is disabled One input to the AND gates for bits 4 7 is set high so that the multiplier word can pass through the AND gates to the B inputs of the adders for bits 4 7 where it is added to the current value in the accumulator bits 4 7 which are zeros initially Since bit 7 of the accumulator is zero the AND gates for bits 0 3 are forced into a low state setti
11. buzzing tones to security system s delay circuits to the crystal based clocks that provide the heartbeat of every modern computer a variety of methods exists to generate oscillating signals In this lab we shall explore some of them 4 1 555 timer IC as a square wave generator out Additional components required e one 555 timer IC chip e miscellaneous capacitors and resistors The data sheet for this part describes the various 15V modes of operation connection diagrams and resulting waveforms This timer has a monostable or one shot v mode where a high to low transition on the trigger input SR initiates a single pulse of a specific duration at the output The circuit can also be configured as a self triggering Wiggs BS OE astable pulse generator Figure 4 1 You should pay tions for the astable configuration of the 555 timer as they determine the duty cycle of the output pulse The duty cycle of a digital on off waveform refers to the propor tion of the time that the signal is on relative to the overall C 0 0OluF period of the signal 3l our THRI particular attention to the charging and discharging equa R2 4 RES CONJ 5 1 Construct the 555 oscillator circuit shown in Fig ure 4 1 Refer to the internal schematic diagram Figure 4 1 555 Oscillator shown in Figure 4 3 to understand its operation o Ch
12. course has some select pointers in the section and is a good place to start 1 D Barnaal Analog and Digital Electronics for Scientific Applications Waveland Press 1982 TK7816 B34 J J Brophy Basic Electronics for Scientists McGraw Hill 1990 TK7815 B74 M M Cirovic Basic Electronics Devices Circuits and Systems 1974 TK7815 C53 A J Diefenderfer and B E Holton Principles of Electronic Instrumentation Saunders College Pub 1994 W L Faissler An Introduction to Modern Electronics J Wiley amp Sons 1991 P Horowitz and W Hill The Art of Electronics Cambridge University Press New York 1989 TK7815 H67 H V Malmstadt C G Enke and S R Crouch Electronics and Instrumentation for Scientists Benjamin Cummings Publishing Co 1981 R E Simpson Introductory Electronics for Scientists and Engineers Allyn and Bacon Boston 1987 vi NAME PRINT STUDENT ID LAB DATE GRADE Experiment 1 Introduction to Electronics Workbench 1 1 Preliminaries You may be quite familiar with using a general purpose computer such as a Windows PC or a Mac but the computer environment you will find yourself in in the Electronics lab is more specialized and may present additional challenges Be sure to attend the introductory lecture offered by the Brock Information Technology Services ITS early on in the semester The computing environment around Brock evolves quickly your lab instructor should have the mo
13. is the active edge of the counting input Sketch a timing diagram for a sequence of several cycles of the counter starting with the state of the outputs that represents the decimal 9 and including all relevant input and output lines Q Complete the circuit by adding a push button switch debounced with the help of a 555 monostable Verify a reliable counter operation Choose the RC values so that the fastest sequence of pushes of the switch that you can produce does not miss any and does not have any extra ones Vary the RC until the time constant is too short to provide effective debouncing and you just start seeing multiple counts for a single pressing of the push button What is the minimum pulse width that would provide reliable debouncing T Time permitting explore other modes of operation of the 74192 A second switch debounced with another 555 based one shot can be connected to the Down input providing two button up down counter A combination of four bits could be preloaded into the counter by pulsing on a Load input active low This is a decimal counter so normally it shows only values from 0 to 9 what would happen if you pre loaded a binary coded four bit value that is greater than 9 NAME PRINT STUDENT ID LAB DATE GRADE Experiment 6 Four bit multipliers In this lab we implement in hardware some algorithms that multiply two 4 bit numbers to yield an 8 bit result The operating speed and hardware comple
14. it first loads the W register with a literal value and then exits by executing a return from subroutine instruction You can use a lookup table to convert binary data into bit patterns that corresponds to a decimal digit on the seven segment display Determine from the PICLab schematic the mapping of PORTD pins to the display segments and write down the bit patterns that represent decimal digits 0 through 7 on the seven segment display D Append the following code to the above program that is why you needed the explicit return at the end of it and convert your keypad data by calling the Convert subroutine at an appropriate time in your program Explain the program flow of this code What is the purpose of the andlw instruction Convert andlw 7 3 a eae e eaa a a e a a a a a E a ss heed addwf PCL F So a n aana se aea aa eae a Miata a oe aaa retlw 400111111 seven segment bit pattern for digit 0 retlw V E EE E S E AE retlw JEn E A PRL A A AE Ea A A a tees retlw Uj Pree ce Bi ei Me Re ON Be MD E Ie Esti Be Baa Beta retlw yA A EA EAA A EA EE retlw aa een BS E AT I EIR casas Nae AE EE retlw Aa S SOU Tree To Coni Coi Coe a Pe d Bs a E AE E AREA retlw VEFES aaa a a a a a E A OT Each seven segment display consists of eight LEDs connected together at the cathode The PORTD pins connect to the individual LED anodes With the common cathode pins of each display connected to ground it would require 32 bits to control the four displays of the
15. observe the be haviour of the circuit Note when the LED is on and when it is off circle below in terms of the voltage at the base Vp and at the collector V of the transistor and the corresponding voltages across the compo nents low __ on fof on fof high __ on off on oF Figure 1 2 Transistor as a switch 1 5 DIGITAL INDICATORS AND CONTROLS 5 Explain the operation of the circuit for the two input states What is the purpose of the 470 Q and 10 KQ resistors What logic operation does the transistor perform What is the maximum current that could flow through the LED 1 5 Digital indicators and controls D Clear the screen of all components or simply open a new circuit page Find and drag down into your circuit page the word generator from the Instruments submenu and several one bit logic probes from the Indicators submenu You can enter sequences of 4 digit hexadecimal numbers in the data window or load a stored pattern The sequencer can be single stepped or made to cycle through this list at a certain predetermined pace The sequencer can also be put into an infinite loop repeating the steps you programmed and returning back to the beginning For each number the corresponding pattern of high low voltage levels is produced on its 16 outputs Edit the pattern list to contain a few lines with different bit patterns try to include FF 00 and other interesting bit patterns in your sequence Ste
16. significant bits of the converted value to determine which key was pressed o picl has predefined pointers to the 7 segment LED displays called DigitO Digit3 a subrou tine equivalent to Scan7seg called Refresh and a routine LedTable similar to your Convert routine that converts a value 0 Ox0F contained in W to the 7 segment pattern for the corre sponding hex digit For convenience and to make your code more compact use these as part of your programs The following code reads a 10 bit value from the A D converter channel connected to the keypad and displays it as three hexadecimal digits on the LED display Complete the missing code and verify that the program functions as expected UserISRon Refresh define LED display scanning routine as user ISR bsf Flags USERISR enable execution of user interrupt routine begin esas se ee select the keypad channel Saaete AAA read 10 bit A D value store in WH WL hekur Liana place lower 8 bits of 10 bit A D value in W kalisa Taoa set bits 4 7 to zero bits 0 3 are A D bits 0 3 call LedTable convert value in W to 7 segment hex digit movwf Digito display hex digit for A D bits 0 3 swapf WLW place swapped nibbles hex digits from WL into W Seba GiT set bits 4 7 to zero bits 0 3 are A D bits 4 7 Heren Spelt convert value in W to 7 segment hex digit Perse Weta ts display hex digit for A D bits 4 7 eheeatergl dee ee place upper 2 bits of 10 bit A D value in W arose ee conve
17. since no preset logic is required for 6 3 AN ARRAY MULTIPLIER 27 it A down counter would have to be loaded with the count value and use some logic to detect a zero output When the shift counter reaches four it sets the OR gate high disabling further counts until a reset re initializes the circuit o Simulate and verify the proper operation of the shift add multiplier circuit Consider some improvements to the circuit For example you may want to terminate the multiplication prematurely when one or both of the data words are zero Since the multiplier value is set by switches it is the accumulator value that is being left shifted Choose an arbitrary pair of 4 bit values for the multiplicand and the multiplier and step through an entire multiplication cycle recording the state of the accumulator after each step Identify what happens to the multiplier bits initially at bits 4 7 through the cycle An alternate strategy would select the multiplier bit to test is it 1 or 0 using a multiplexer driven by a down counter at its inputs Sketch the relevant part of the circuit based on this idea Compare this strategy to the one used in the circuit of Fig 6 3 Compare the summing and the shift add circuit implementations How does the number of cycles required vary for the two circuits Itemize the changes that you would need to make to the two circuits in order to perform an 8x8 multiplication resulting in a 16 bit product How does th
18. the board you have access to five pairs of banana jacks red and black Also there are five BNC coaxial connectors A cable supplies the board with 15 5 and 0 Volts DC The black banana jacks and the outer ring of the BNC connectors have a common connection to ground or OV These signals are all available to the protoboard the matrix that you will build your circuits on as shown in Figure 2 1 BP A O P a o0 O BP2 BP3 BP4 BPS BNC BP connections have a common ground Power connections extend only to middle of board Pins are grouped in rows of five BNC1 C2 BNC3 BNC4 15V Gnd OV 15V 5V Figure 2 1 Electronics lab breadboard connection matrix These logic gates are then used to construct various simple logic circuits such as an adder a latch and a binary counter The breadboard BNCS EXPERIMENT 2 LOGIC GATES To make the experience of assembling a working circuit more enjoyable Be sure that the power is OFF assemble the circuit in a systematic and organized fashion check off each component as you add it to your circuit 1 2 verify by direct measurement the values of all the circuit components 3 minimize the use of jumper wires by connecting components directly to one another 4 verify that the jumper wires used are not broken test for 0 Q resistance 5 6 7 verify that your assembled
19. to generate a Gnuplot graph of your data Check the Lines box to interpolate the data with line segments 3 write programs that implement in software the summing and shift add algorithms used to multiply two 4 bit numbers that were implemented in hardware as part of Experiment 6 Begin by reviewing the arithmetic instructions available to the PIC and their effect on the carry C and zero Z flags contained in the STATUS register 3 ASCII refers to the American Standard Code for Information Interchange where an 8 bit value is used to represent the character set of alphanumeric characters a z A Z 0 9 as well as other symbols typically found on a keyboard such as Coded in the range of ASCII 0 0x1F are non printed control characters NAME PRINT STUDENT ID LAB DATE GRADE Experiment 9 PICLab data acquisition project This PIC project is meant as a chance for you to put all your skills in digital analog electronics PIC programming interfacing and practical problem solving to use and to build a useful device of your own Your project will consist of the following steps 1 research the research cycle involves a preliminary exploration of possible project ideas where the hard ware and software implementation options and perceived design difficulties are considered Analyse the evolutionary steps involved in the design process that need to be successively fulfilled to make your project work the choice of input sensors the interpreta
20. unsuccessful 4 presentation as a final step you will make an oral presentation consisting of a demonstration of the working project and a description of its operation The presentation concludes with an assessment of your final result in terms of the goals set out in the project proposal You should have available for submission a printed copy of your design records as well as a user manual that describes the device opeartion and includes hardware schematics and software code Below are several simple ideas you are welcome to suggest a similar project of your own for approval by the instructor 47 48 EXPERIMENT 9 PICLAB DATA ACQUISITION PROJECT 9 1 A PID temperature controller One of the simple ways of controlling semi continuously the state of a system is through the ad justment of the ratio of on off times For example if the temperature of a reservoir is below the target temperature we turn the heater on and if it exceeds the target temperature we turn the heater off A temperature sensor and a TTL relay acting as the power switch for the heater under the control of a microprocessor is enough to implement a simple temperature controller However a truly intelligent controller would implement the so called PID Proportional Integral Derivative control algorithm whereby the temperature difference with the target temperature P the time integral of temperature I and the time rate of change of temperature D are all monitored
21. 03FF 40 EXPERIMENT 8 PICLAB PROGRAMMING 8 1 Assembler instructions and code development You are now ready to begin programming As you progress through the exercises be sure to understand the function of each instruction see the help menu and the overall logic of the program code Familiarity with the PIC instruction set and with these basic technoques of interacting with PICLab will make programming the PICLab board a more pleasurable experience D Start the picl application Connect to PICLab In the following steps the comments shown in brackets do not need to be entered the text can be formatted using the tab key Begin by sending to the PIC an instruction to turn on bit 7 of its Port D This pin is connected to the decimal point of the seven segment displays In the entry window input the following opcode bsf PORTD 7 set bit 7 of file register PORTD Click the button The LED attached to bit 7 of Port D on the PIC should turn on Modify the above instruction to read as follows bcf PORTD 7 clear bit 7 of file register PORTD Clicking should turn off the LED D You will now implement a loop Enter the following code begin bsf PORTD 7 set bit 7 of file register PORTD bcf PORTD 7 clear bit 7 of file register PORTD goto begin branch to label called begin Since the program is toggling the Port D bit on and off a couple of times every microsecond the LED should appear continuously lit but somewhat dimmer The
22. Brock University Physics Department St Catharines Ontario Canada L2S 3A1 Puys 2P32 Electronics II Laboratory Manual E Sternin and F Boseglav Copyright Brock University 2013 2014 Contents Preface ili Hi ROCIO Bes se Seo Sieh Bete ee EO rae SOR GO ER ge See a ee eg re a ee Se iii Conventions used in this manual Sy ee dk ene ee eek oe BS Ye oe OS So he eee S v Plotting and fitting with physica aoaaa aa a v References r maaa a do a Rh a rE A ah ec E a are ae ere Sg BSA v 1 Introduction to Electronics Workbench 1 Ta RrelminarieSs inos rE wh Sg Ley at AP hee lt a LN aa eid aE eng Bree 1 1 2 Virtual circuits in Electronics Workbench aoaaa aaa eS Se See Ses 1 1 3 Real and ideal meters atc oe Awe Eds ek Sa Seta ees 3 1 4 Review of basic electronic components ooo a a 0050s eee 4 1 5 Digital indicators and controls 2 a 5 1 6 Bit combinations control a 7 segment LED display 6 2 Logic Gates 7 2 1 Circuit assembly techniques s tee cay 205 ie As Tate Bes Meg eae Eh aed eee Se Sets T 2 2 Combinations of NAND gates implement other operations 8 2 3 A binary counter aoaaa a 9 3 Combinatorial and sequential logic 11 oul Divides by two flip flop ooo sb ded BY be Boke ea ke ea Bas PPS PS 11 3 2 A binary counter with D flip flops 5 4 hed Bea ae eR EA ee ws we OS 12 3 3 One of eight decoder o oo a a 13 34 A desin challenge 452 kate doa ae a Aa ai a
23. E incf 7seg_ptr F Be a a a E acon la calong long te Gt 8 a as movlw 3 Fo Wetec tere e lode ee Jets A a a E E a TE E E a a i andwf Tseg_ptr F B E dese oe E S A A tee movlw Oxf0 G2 Guitar Dean ty er Seneca Dee en tae ata aria ain orn E EA sone wus andwf PORTB F Sy Was eas seas eds eas Ge a E I E Nene tens me hoe ean ters Gove aut call Show7seg EEEREN EREA IN Mate deta tat takes Maes te Oke gaat eae eee iorwf PORTB F Soe e sydd E et tes what cal SHlananntiyes EE return pr I O E tad tat tate bahia E y oe Show7seg i PoP le Onde Us 20s 0 ad Cada iPad atten da er Ae Re ee hell EEES movf 7seg_ptr W PR CECE RCE CR ERR RETRO R ACRE ee ee Pao Ce eens ee ee eae ae addwf PCL F Bs etlnda Co A de de coda hse Pde VS Raed ad opie E wig ots goto Show0 Bo ae E EEA goto Showl GER eit Mo e Breed eeahaes eal teal vel aan eee te bee deg goto Show2 FETS OTe te E RR GBI RN ena Ba tend oe goto Show3 i e a eaa a B Heo tale Melanie E E ateMete avec ee eles Mattia acess Show0 Move PSCZLOSPORTD coe cece eee eee chat TRE viet coated doe cng eae tat E wusegidhy SS retlw 400000001 bit 0 selects display 0 active high Showl Move Pseg 1sPORTD sh eter Mirena asda sree A ee ee Be retlw 00000010 gt utepuehouue suet ocen suet ocsedeet uenene sen A se Seah Show2 Move Taeg 2 POR TD oi veri horns sears org toons une ane ong one aed ohn ods bod Ae ree tele aviacsd retlw 00000100 BD cial oh R oh cian asian a chan Saale aan a Nottie i tee ny Show3 Move SCG s POR TD 3 gt
24. Lab Fig 8 2 shows what picl window should look like on your screen Typically you enter one or more opcodes in the entry window and click Build If the assembly completes without errors PICLab loads the given instruction s to the Flash program memory and executes them This code will not erase if the PIC is reset or the power is turned off You can execute the program currently stored in the PIC memory by clicking the button As the program runs PICLab sends a variety of data back to the user You can open several windows in the menu to keep track of how the values in the PIC registers and memory change as a result of your instructions being executed Click the button for help on the PIC opcodes assembler directive commands and a list of the utility subroutines pre written for you to use in your programs Click Exit in the File menui when done your working environment will be saved To program PICLab from your laptop or PC you need picl and the Tcl Tk 8 4 interpreter installed it is freely available for all platforms at www activestate com You may also need to specify the connection e g dev piclab or dev ttyUSBn under Linux or COMn under Windows where n is the desired port Under Windows a USB serial device is identified as a COM port By default the loader chooses 0x0400 as the starting address of the user program out of the total program address space of PIC of 0x0000 0x1FFF the loader itself is using 0x0000 0x
25. PICLab board 8 3 MACROS AND SUBROUTINES 43 A more efficient use of resources employs the technique of time multiplexing to generate an output on the four displays Here the digits are displayed sequentially with only one of the four digits enabled at anytime If the switching between digits is sufficiently rapid the persistence of the human eye creates the illusion that all the digits are on at the same time Four output pins PORTB pins 0 3 control the voltage at the display cathodes via current driving transistors The corresponding anodes of the four displays are connected in parallel refer to the PICLab schematic Fig 8 1 A software loop then enables each of the displays in turn while the bit pattern corresponding to that digit is presented on the PORTD pins With multiplexing the pin count has been reduced to 12 from 32 a saving of 20 input output pins D Develop a flowchart to multiplex four different digits of data on the PICLab display Convert the flowchart to PIC instructions and test your code T Vary the loop timing to determine the minimum refresh rate necessary to prevent the display from flickering 8 3 Macros and subroutines A Macro is a group of instructions that are referred to as a single new instruction During assembly every time a Macro instruction is encountered the original group of instructions is assembled into the program A subroutine consists of a group of instructions within the user program that b
26. PICLab board is now executing an infinite loop and will not respond to commands Connect an oscilloscope to pin 7 of PORTD on the expansion connector Sketch and label the output waveform Explain the timing in terms of the PIC instruction execution times Is the timing in agreement with your expectations D Press the button on the PICLab board to interrupt the program and regain control of the hardware You can slow down the LED flashing rate by introducing a long in PIC terms delay after each of the bit operations A utility subroutine called Wait is available to implement such a delay The W register is loaded with a delay value to be passed to the subroutine Try the following code begin bsf PORTD 7 set bit 7 of file register PORTD movlw 250 pass delay count to Wait subroutine call Wait execute a delay of 250 150us bcf PORTD 7 clear bit 7 of file register PORTD movlw 250 delay value for Wait subroutine call Wait execute a delay of 250 150us goto begin branch to label called begin The flashing of the LED is now clearly noticeable Vary the value in the movlw instructions to observe how the flashing rate varies 8 2 LOOPS CONDITIONAL BRANCHING AND CALLS TO SUBROUTINES Al 8 2 Loops conditional branching and calls to subroutines The next step in our exploration of PIC programming is to add some flow control to the program s execution One possibility is to have the algorithm flash the LED a set number of time
27. ack stage where the results are either reported to the user recorded for later analysis or used to provide signals to actuators and control devices of a physical system At this stage the feedback loop back to the physical realm is closed Pressing a push button switch counting these contact closures and displaying the resulting tally on a seven segment display are the three stages of this lab experiment but this general three stage structure is shared by virtually all electronic devices involved in the interactions with the physical world Sketch a block diagram representing the way an electronic system would gather the informa tion about the physical world process it electronically and implement the resulting control decision Briefly describe an example different from this experiment that you diagram may represent For your example experiment indicate the approximate bandwidth requirements or the amount of information per unit time that you expect to be communicated between the various blocks on your diagram Where do you expect the bottlenecks to occur 19 20 EXPERIMENT 5 BUILDING A COUNTER VCC VCC atyce 1k Ohm 100 k Ohm up down counter one shot debouncer 4 k Vec 16 l i a eola 2 QB A H e e a a a CLR Hie T RES CoN 4 DOWN ale i UP CO p 2 o 1uF S Qc LOAD p t___ Z QD c Hee e GND D
28. an S shaped bend designed to hold the part in place during the automated assembly process You will need to carefully straighten the pins of all the switches with pliers so that they can be inserted into the PICLab board Be sure that the switch is flush with the PC board then solder it in place D Install the 20 MHz PIC oscillator crystal Y1 and oscillator capacitors C5 and C6 T Install the power LED noting that the positive side of the diode corresponds to the longer lead the LED current limiting resistor R8 and 500mA solid state fuse a small flat yellow disk at the location marked Fuses 0 5A 1 A three pin jumper next to the fuse can be installed to select the source pf power to the board either from the USB connection USB or from an on board power supply VDC To power the board only from the USB interface connect a piece of wire from the middle hole to the end hole labeled USB 34 EXPERIMENT 7 PICLAB PROJECT BOARD D The location RN1 for the display segment current limiting resistors can accept a resistor network an IC that integrates eight resistors in one package or discrete resistors You will use eight discrete 330 Q resistors for this purpose Install side by side and solder the eight resistors at location RN1 1 Install the four 2 2 KQ resistors R2 to R5 that limit the base current of the transistors Q1 to Q4 Q The 2N4401 or 2N3904 transistors Q1 to Q4 must be properly nstalled Hold the transistor upri
29. and the output is controlled by all three with varying weight contributions The reasoning is simple a purely Proportional control always overshoots the target and depending on the thermal inertia of the heater may end up always oscillating about the target temperature Including the other contributions I D can produce an approach to the target temperature that is free of overshooting and maintain a stable target temperature A further improvement is to automatically adjust the relative weights of the P I and D contributions to maintain this stability even if the thermal inertial properties are changing for example as the level of the fluid in the reservoir is changing 9 2 An ultrasonic pinger First developed for distance measurement in autofocus cameras ultrasonic distance measurement is based on a simple time of flight measurement for an ultrasonic sound pulse It can be used to measure distances with high precision 2mm is typical using a standard ultrasonic transceiver both a transmitter of the pulse and a receiver of the echo signal from a distant object and a timer counter that measures the time between the sending of the pulse and the receiving of the echo With proper calibration the speed of sound in the air varies with temperature and humidity a transceiver interfaced to a microcontroller is an excellent distance measuring device It can be used in a Mechanics lab or for non contact level measurements in a well or as a park
30. ast majority of computers in the world do not run Windows Unix or Linux They do not execute word processing or multimedia applications These are the computers that run appliances such as your television VCR microwave and cell phone These intelligent devices are known as embedded processors microcontrollers or peripheral interface controllers PICs They are used to perform specific repetitive tasks that require low computational resources such as disk space or high throughput video processors and little or no human intervention In contrast to the typical number crunching desktop computer these devices excel in their ability to communicate with the world around them To this end a microcontroller IC not only implements the basic arithmetic and logical functions of a typical microprocessor but also includes a variety of programmable input output ports hardware timers analog to digital converters and a fast and efficient means of interrupting the execution of the microcontroller program to service a variety of external or internal events A very capable example of a microcontroller is the Microchip PIC16F877 This 40 pin IC in cludes an 8 bit reduced instruction set RISC processor with 35 instructions 8k words of re writable flash program memory 512 bytes of scratchpad RAM memory and system registers 256 bytes of electrically re writable EEPROM data memory There are 33 programmable input output pins an 8 channel analog to digital
31. can operate as a stand alone device A five button expandable 29 30 EXPERIMENT 7 PICLAB PROJECT BOARD keypad can be used to input data and control the operation of the project board For the display of output data a four digit seven segment LED display can be utilized Alternately a more elaborate LCD alphanumeric display of 2 lines of 16 characters each can be used This intelligent display has its own character memory and is programmed with a set of commands much like the microcontroller chip itself This device might be used as a programmable thermostat an alarm clock or a battery powered portable instrument such as a digital voltmeter A PICLab board also can operate as a remote device Connected via a serial RS 232 port or a much faster USB port a computer or terminal can accept and display the PICLab s output data send the PICLab commands and even change the program that the microcontroller is executing Connected to a modem modulator demodulator the PICLab could send an alert via the telephone to inform that the system needs attention This device might be interfaced to several motion detectors and used as an intrusion alarm system or other household monitoring device or as a remote data acquisition module The PICLab project board was designed at the Physics Department specifically as a convenient platform for several experiments in this course Later on you will learn the basics of Assembly language programming A D an
32. circuit connections correspond to those of the schematic diagram 8 turn ON the power and test the circuit for proper opearation If the circuit does not behave as expected you will need to do some troubleshooting Use the schematic diagram as a guide to determine the voltage levels that should be present at various points of the circuit then use a voltmeter to measure these nodes Develop a systematic approach to assembly and verification of the circuit that you are building As the circuits get more complicated you will find it advantageous to construct the circuit in stages verifying the proper operation of the circuit after each progressive step 2 2 Combinations of NAND gates implement other opera tions Additional components required e two 7400 IC chips and one 7473 IC chip e four LEDs and five 470 Q current limiting resistors 5V 2D y Ly VY Y R 4700 cathode of LED is the short wire Figure 2 2 An OR gate made from NAND gates NAND gates can be com bined to form other logic gates You must prepare for this lab by designing and drawing the schematic diagrams of the follow ing circuits made up entirely of NAND gates e an AND gate e an exclusive OR XOR gate e a half adder e a gated latch In the example shown in Fig ure 2 2 three NAND gates form an OR gate The LEDs on this diagram monitor the state of the inputs and the output Each one is co
33. circuit in Figure 3 3 1 0 y lam a i I J Gere 2 7 O Figure 3 3 Binary to one of eight decoder 3 4 A design challenge The challenge is to design an extension of the decoder circuit that lights a green indicator if and only if a special sequence a password of two 3 bit numbers is presented at the input and a red indicator for any other combination of two input numbers Q Sketch a flowchart of the logical steps that are required to solve the problem From this develop a timing diagram of the different signals that your circuit needs to generate 1 Replace the binary counter with the pattern generator Verify that you know the pattern of 3 bit inputs that turns on any desired light Note that the Data Ready output of the pattern generator makes a low to high transition when the the next data word is latched at the outputs 14 EXPERIMENT 3 COMBINATORIAL AND SEQUENTIAL LOGIC Monitor the circuit with the logic analyzer How does the timing of your circuit compare with that of your timing diagram How would you expand your circuit to decode a series of three 3 bit numbers NAME PRINT STUDENT ID LAB DATE GRADE Experiment 4 Oscillators and clock circuits One does not always have the convenience of a frequency generator From simple os cillator circuits that provide
34. clicks you can assemble an entire virtual circuit that includes passive and active components meters oscilloscopes and other virtual counterparts to the real devices and instruments found in an electronics lab There is one important difference to working with a virtual circuit As you are putting it together the program creates a set of mathematical equations that describe the circuit As you then flick the virtual ON switch the computer proceeds to solve these equations quickly and with great precision and reports and even plots the results A variety of values can be swept through quickly and automatically to discover the optimum ones an entire frequency response curve can be obtained with a single click of a mouse What happens is that you are able to concentrate on the physics of the problem and not on the sometimes tedious details of setting up and solving a fairly large system of coupled linear and differential equations You do not need to be careful with the details of these calculations and you concentrate instead on making sure you understood the behaviour of the circuit and how this behaviour relates to the underlying theory When you concentrate on the concepts and avoid applying by rote a memorized set of steps you are studying for mastery When you understand what is going on behind the equations you can apply that understanding to problems where the rote method is sure to fail In our computer assisted labs you will learn to t
35. converter ADC three event counters timers and a univer sal synchronous asynchronous receiver transmitter USART capable of communication at up to 1 25Mbits s With a 4 MHz clock oscillator each instruction requires 1 us to execute The device will operate at up to 20 MHz and execute five million instructions per second This microcontroller can be programmed in circuit with an in circuit serial programmer ICSP or it can reprogram itself by downloading a new program via the serial COM port of a PC or terminal Brock s PICLab microcontroller project board is compatible with the Microchip PIC16F8xx se ries of ICs This family includes two 40 pin versions PICI6F874 877 and two 28 pin versions PIC16F873 876 These chips are functionally identical but differ in the number of input output pins and the size of the program and data memory The PICLab project board includes a variety of peripheral circuits intended to simplify the development of a microcontroller based project Included are the circuits required to drive a 7 segment LED display an interface to an LCD display a keypad a serial RS232 or USB interface relays and current drivers for the control of external devices and an in circuit programming interface There is also a small prototyping area for the inclusion of extra components The PICLab can be powered from a 9 V DC wall wart a battery or it can extract power from a computer s USB port A fully assembled PICLab board
36. d D A conversion and other aspects of computer assisted data acquisition and control In this experiment you will build your own PICLab workstation by assembling soldering a project board of your own 7 2 Pre assembly review of parts and tools Be sure to examine the schematics diagram of the project board provided separately You are not expected to understand all of the details yet however you need to learn to recognize the overall relationship between what is on the schematics and its physical implementation on the project board The locations of various components on the printed circuit board see below are well marked Examine in particular the keypad part of the circuit diagram What should happen when you press various normally open N O momentary switches Note how instead of multiple binary logic lines to the PIC multiple switches are connected to a single ADC input Measuring the voltage on this line the PIC can determine which of the switches is pressed Figure 7 1 A PICLab printed circuit board version 1 0 the component side The project board is a high quality double sided printed circuit board The conductive traces on the fiberglass substrate are Pre tinned for ease of soldering and both sides of the board 7 2 PRE ASSEMBLY REVIEW OF PARTS AND TOOLS 31 are covered with a solder mask to minimize the possibility of solder connections between adjacent traces To simplify parts placement the top or component side
37. da ale da ded 13 A Oscillators and clock circuits 15 4 1 555 timer IC as a Square wave generator eco we a at eA Ghd eR ee ee 15 4 2 Crystal oscillator and ripple counter ooa oaa ie Pe a 16 4 3 Review operational amplifiers cio alg sd wk eee Dele ee ee HAD Ce A 17 5 Building a counter 19 5 1 Building a device stage by stage ooo aa ee 19 52 Asvirt al Prototype e is x ace Ak dh 4h iol Bde rde a Sr Oa Gey ew os Rew 20 5 3 Cirett realization ee oa asp there ed as el herig ed a Ge le SA eg ke Pl SOR A ee gt ya 21 6 Four bit multipliers 23 6 1 A summing multiplier ooa a 23 6 2 A shift add multiplier oao aa ke Poet he Ake kA Ue Bo Bo 25 6 3 An atray multiplier sss ces ar sa 4 al a eye amp Sc Re amp e Bee R a 27 6 4 Look up table multiplier 2 si8 sia oe Gia a ae Oe ake By ess BAS late eatin ws go ap sk 27 7 PICLab project board 29 Tak JTatroductions s ea S fe 08 62 Bot a oid one e hoe Bee oe Bee und 2 lees 29 7 2 Pre assembly review of parts and tools 00 00020000 30 7 3 Assembly of a PICLab project board 2 0 sia ee ae ede aos Be aS 33 7 4 PICLab basic functionality tests oa aa a Pe ees ee 35 8 PICLab programming 37 8 1 Assembler instructions and code development oaoa oo a a a 40 8 2 Loops conditional branching and calls to subroutines o a s a a aa 41 8 3 Macros and subroutines oaoa a a BE at ee ES oe ee 43 SA Tatert pts s a a nosey pre rn ice oe ats A ye As a a TA a a ee TAE ee
38. des A more ambitious project would involve two directional communications both reading what the other IR transmitter is sending and sending one s own signals out This is easily implemented using a microcontroller this is what is at the heart of all universal programmable remote controls that are widely available With 50 EXPERIMENT 9 PICLAB DATA ACQUISITION PROJECT a microcontroller based decoder encoder attached to a serial port you can make your computer communicate with all such devices and to replace all of your remote controls with a software one 9 8 A PIC based mouse controller A typical electromechanical pointing device a mouse has a large rubberized ball rolling on the work surface and in turn rotating two orthogonal slotted wheels one for the x and one for the y motion Each slotted wheel interrupts two infrared beams producing a pair of logical pulses 90 out of phase Each pair of pulses corresponds to a step of displacement and their relative phase determines the direction of motion Typically these TTL signals are converted by a dedicated mouse controller IC into a stream of codes sent through a serial connection to the computer reporting the displacement of the mouse The same task could be performed in software running on a microcontroller In this way non standard display modes for example direction and velocity display could be programmed If a sufficiently fine resolution can be obtained the two wheel
39. determine the propagation delay from CP to the Q outputs Record the analyzer output Consider the relationship between the various signals in the two timimg diagrams Why does the timing in the two diagrams seem to differ Based on your observations write down the 11 12 EXPERIMENT 3 COMBINATORIAL AND SEQUENTIAL LOGIC truth table for a D flip flop Compare with that of a real D flip flop device such as a 4013 by reviewing the device data sheet 3 2 A binary counter with D flip flops Several D flip flops connected in a chain perform as a binary ripple counter each stage undergoing a change of state half as frequently as the previous one In this circuit slow the clock down to 1 Hz or so and use just a set of LED indicators to read off the binary count 1 Assemble the circuit as shown and verify its operation You may want to assemble one binary digit first then select several circuit elements and Copy and Paste several times to expand to more digits Label the most and the least significant bits as MSB and LSB respectively 1 F D U D Q DQ D i gt Q i gt Q ii i gt QQ gt 20 MHz 50 Sample 500 MHz 6 6 6 6 0 i kaj kaj ka ka ka ka Figure 3 2 A binary counter The logic analyzer allows you to monitor the output waveforms and thus to verify the operation of the counter Taken together the four Q output lines represent a 4 bit binary val
40. e 74192 Figure 5 1 EWB circuit diagram 5 2 A virtual prototype A 74192 IC is a convenient decimal counter capable of reset to zero preloading with a specified value and of counting both up and down as well as generating carry and borrow signals that allow one to construct multidigit counters We will explore only a very limited subset of its capabilities Use Electronics Workbench to simulate the circuit shown in Fig 5 1 Initially connect a 74192 and a four input BCD decoded seven segment display and connect a switch that will alternately toggle between a Vc and the ground directly to the Up pin on the IC A virtual switch toggles cleanly and instantly and will require no de bouncing T Verify the operation of the counter You may want to add additional elements such as logic probes on the outputs of the 74192 to make this task easier See if using the switch to toggle the Down input of the 74192 while holding its Up input high produces the expected down counting Download from the web or look up in a data book available in the lab the datasheet of a 74192 How is the counting by 10 realized inside the IC out of four flip flops connected in series What is this technique called Y Now complete the full circuit of Fig 5 1 by connecting the 555 based debouncer Choose ex ternal RC values so that the width of a pulse generated by the monostable is longer than about 50ms a typical settling time of a real
41. e References section of the class website this information should be sufficient for you to get your PICs to work 37 38 EXPERIMENT 8 PICLAB PROGRAMMING Pic pSV COMMON CATHODE DISPLAY 1OK keypad 2 dp 3 od sd ud 3d 2d Ts eE 8 a g l I 14 x x Ww t SN om of oy 3 b a 45V mg isd avbe Sv q ia REGULATOR 7 a 100 k power sopply V 22pf 13 2N4401 TEN 3 yma apt 4 ar osu lator IESP Reser Rx om IOR i Tx 3 CTs 8 RTS od 4 GND 34 LeveL 10 pin CABLE BESS TaAmseatok weabER Opin HEADER Figure 8 1 Block diagram of a PICLab board 39 Connecting PICLab By default picl enters the PIC Simulator mode on start up with the Connect icon showing a single plug meaning that PICLab is not currently connected to PICL With your PICLab board connected to the USB port of your Linux workstation and the port set to dev piclab click the connection icon The icon changes to two connected plugs a message Connected to PICLab at 57600 baud appears in the status box and picl is ready to communicate with PICLab Check the Auto connect box in the Settings menu to detect and connect to PICLab on start up PICLab interface On your Linux workstation invoke the graphical user interface to PICLab by typing picl amp picko ader v7 05 14 untilledasm O File Edit View Options W Autorun Build Run Port dev piclab Figure 8 2 picl application window connected to PIC
42. e from these results the response time of your eyes Lab Report Submit a lab report consisting of the work undertaken during this lab Start the report with an overall statement of purpose of the experiments Then for each exercise include a sketch or printout of the circuit and graphs of the waveforms observed formula derivations a description of the theoretical behaviour of the circuit and comparison with your actual observations and answers to the pertinent questions The presentation of your results should be organized and complete your diagrams titled and referenced so that someone who is not familiar with the experiments would have no difficulty understanding what was done At the end of the lab report include a brief Conclusions section that summarizes and compares the results from the simulated and hands on portions of the lab and a discussion of any problems encountered and insights gained NAME PRINT STUDENT ID LAB DATE GRADE Experiment 3 Combinatorial and sequential logic In combinatorial digital logic circuits the state of the outputs is determined by the state of the inputs and a Boolean logic equation or a truth table can describe the function of the circuit in a very compact way In the sequential logic the state of the inputs at some earlier time may also matter and a full desription of the function of the circuit involves a timing diagram with logic levels transitions between levels and their time relationship p
43. e timing and gate count of the circuits vary with the size of the data word 6 3 An array multiplier Consider Figure 6 4 a design for a 4 bit array multiplier Here the four cycles of shift add oper ations have been piggybacked into several stages that perform the series of operations all at once combinatorially rather than sequentially T Simulate and verify the proper operation of the array multiplier circuit Does this circuit offer a better performance than the shift add multiplier 6 4 Look up table multiplier Another possibility especially when performing complicated arithmetic calculations such as evalu ating the sine of an angle is to use a lookup table Here a matrix of latches generically known as storage memory is loaded with all the possible combinations of output values for a series of two input words To implement a 4 bit multiplier a memory array of 256 8 bit words is required The multiplier sets bits 0 3 of the memory address while the multiplicand sets to bits 4 7 The resulting product on the output is simply the the data stored at the address selected by this combination of two 4 bit inputs Evaluate the advantages and disadvantages of using this approach 28 EXPERIMENT 6 FOUR BIT MULTIPLIERS product bit 7 bit 6 bit 1 bit D multiplier multiplicand Figure 6 4 A 4x4 bit array multiplier NAME PRINT STUDENT ID LAB DATE GRADE Experiment 7 PICLab project board 7 1 Introduction The v
44. een If you are lost quit and restart the program 1 2 Virtual circuits in Electronics Workbench Electronics Workbench is essentially an electronics lab in a computer and the way it appears on your computer screen is shown in Fig 1 1 The white field in the middle is the workspace into which you drag various components and devices found in the multiple parts bins divided into several categories just above the workspace When you then bring the mouse near the edges of 2 EXPERIMENT 1 INTRODUCTION TO ELECTRONICS WORKBENCH Menus Circuit Tool Bar Parts Bin Tool Bar Circuit Activate Switch Pause Resume Button Circuit Title oo TS Open 4 d Instrument EA gaa Scroll RE Bar Description ra Window Sf a frequency generator The output is being frequency modulated by the sinusoidally varying voltage at Seat j Ag fom ie TE oo Status Line Scroll Bar Circuit Window Figure 1 1 Electronics Workbench screen each component they turn into dark dots representing nodes of your future circuit Click and drag until a line stretching out of a node reaches a node of another component then release You just connected a virtual wire between the components The wires snap to a grid which can be made explicitly visible through the menu and as you move components around the wires stretch and follow as needed After a few mouse
45. egin with a subroutine name tt label and end with a return statement A call label instruction branches the program to label and executes the subroutine code until the return instruction restores the program flow to the instruction following the call The following code incorporates some practical programming techniques to implement a display multiplexing scheme A macro definition is shown as well as an efficient method of implementing a jump table to select one of several branch possibilities o Analyse and document the code explain clearly the functionality of the subroutines then compare the functionality of this program with your version You may want to save your code into a file say Show4 asm before you build and run it Be sure to add some of your own code to provide meaningful values to 7seg 0 7seg 3 then run the program pahia Show4 asm multiplex the four digit seven segment display 7seg_0 equ 0x20 least significant display digit 7seg_1 equ 0x21 7seg_2 equ 0x22 7seg_3 equ 0x23 most significant display digit 7seg_ptr equ 0x24 pointer to current digit displayed Move macro src dst register to register move modifies W movf src W the macro defines a new Move movwf dst instruction that is not available endm as part of the PIC instruction set your code goes here with a call to Scan7seg 44 EXPERIMENT 8 PICLAB PROGRAMMING return Scan7seg PAE ce ae ON lee ee as a ate TESE E
46. en segment LED display as illustrated in Fig 5 2 1 Start building the counter circuit starting with the final stage the LED display Make sure you have selected a common anode LED display and determine its pinout The common anode requirement is essential as the 7447 decoder uses negative logic it sets those segment lines it wants to activate into the low state Do not forget to connect the common anode pin to the Voe not shown on the diagram The suggested resistor values may not be optimal Consult the 7447 datasheet and that of a typical LED display device to determine the optimal current that would make the LED display as bright as possible yet will not overload the 7447 driver either by exceeding the current carrying capabilities of a single driver line or by exceeding the total power dissipation limits for the worst case scenario of all seven segments being lit at once the digit 8 Add the 74192 counter Use a TTL square wave from the function generator set to a frequency of 0 5 5 Hz as the counting input Note that our version of Electronics Workbench does not have a common anode seven segment display only a common cathode one so if you were to simulate the circuit in Fig 5 2 the display would show patterns complementary to those you would expect for the decimal digits In the lab the real common anode displays are available so the circuit should work as expected 22 EXPERIMENT 5 BUILDING A COUNTER Which
47. erating speed of this circuit You might want to use the logic analyzer to monitor the timing relationship of the various signals o Increase the frequency of the clock to and beyond the operating frequency of the circuit so that a signal race condition occurs What happens Does the noted frequency agree with your estimate from the propagation delay The circuit will continue to add the multiplicand to itself as long as the clock continues to oscil late In this manual mode you are responsible for counting how many clock cycles to provide to implement a particular multiplication operation In addition the limited number of bits quickly produces an overflow condition We need to address both of these limitations 1 Extend the word size of the accumulator to double precision 8 bits You can do this quickly by copying and pasting parts of the current circuit and making the proper connections Verify that you can now serially multiply two arbitrary 4 bit numbers by setting the multiplicand via the four switches and clocking the circuit a number of times given by the multiplier Replace the manual clocking operation with an automatic one using D type latches connected as a down counter as shown in Fig 6 2 Note the additions that have been made to the 8 bit adder circuit The D latches have active low preset and clear inputs Switches set the 4 bit multiplier value which is loaded into the counter on reset The rising edges of the clock pul
48. es workstations with multi meters function generators oscilloscopes pro grammable power supplies and bread boarding stations are provided for this purpose e computer based tutorials using software called Electronics Workbench where virtual cir cuits are assembled tested and analyzed using the common graphical drag and drop skills e graphing and numerical analysis of the results of your real or virtual experiments with the help of the physica software or its graphical version physicalab A typical lab experiment may consist of simulating a circuit choosing the optimal value for some component then assembling the very same circuit on the breadboard in the lab testing it and finally analyzing your measurements and comparing them to the predictions of the theory learned in the lectures Lab books reports and marking Some lab sessions are devoted to the computer based exercises using Electronics Workbench As you go through the exercises be sure to answer all the questions in your lab book and record pertinent observations Screen capture a copy of all the circuits that you simulate and import them into your lab report Be sure to save a copy of all the working circuits to your file space before you begin the simulation Other experiments involve actual electronic components and circuits Sometimes you will assem ble exactly the same circuits that you had simulated in an earlier experiment A similar step by step write up i
49. est your understanding to make up circuits and to predict the results mentally then have the computer verify or not your predictions You will build up your intuition on the subject of Electronics In some sense your efforts will closely parallel what physicists do 1 3 REAL AND IDEAL METERS 3 every day in their research something often called the scientific method organize your knowledge develop a theory make predictions test them by experiment The results of this exploration need to be described in a complete coherent fashion to allow a reader or marker familiar with the subject the opportunity to understand your methodology and attempt to reproduce your data Do not assume that the reader has intimate knowledge of your experimental setup and goals For each of the following exercises explain fully the procedures undertaken your observations followed by a short summary of your results Include screen captures of all circuits simulation output data tables and meaningfully scaled graphs Do not refer to the lab manual include all pertinent details in your own words as part of the report Support all statements and conclusions with experimental evidence or reasoned arguments Hint You can screen capture Electronics Workbench output by going to the OpenSUSE start menu then clicking on Accessories followed by Screenshot In the window that opens select to capture a screen region outline the area of interest by pressing the
50. f 0 99 as a 2 character decimal string The characters sent to picl are stored in a buffer until a newline character ASCII 0x0A is received This is handy when several columns of data need to be sent they will be displayed on the same line until terminated by a newline character To separate your data values with a space send the space character ASCII 0x20 The following code segment outputs the value in WH WL as a decimal string to the PICLab output window call Bin2BCD convert 16 bit value in WH WL to decimal string movlw 6 set field width for BCD2TCL to 6 characters call BCD2TCL send string to TCL buffer movlw Nn load W register with ASCII newline character call TxByte send character flush buffer to display contents For the following exercises begin by sketching a flowchart of the logical steps required to perform the given task then convert each step to one or more PIC instructions that will define your program Be sure to thoroughly document your code Test your code initially on the PIC simulator then execute your program on PICLab 1 write a program that reads the keypad channel and displays the result as a decimal value 0 1023 on the 7 segment LED display The value should change as the various keypad switches are pressed 2 write a program that outputs three pairs of coordinate points 1 2 2 4 3 8 to the PICLab output window The data should appear as an array of three rows by two columns Click the button
51. ften used to supply power to the board After an external power supply has been connected to one of these rows power can be withdrawn to supply electronic circuits at any location along the board Each of the breadboards you will use is assembled on a plug in unit that fits into one of the connectors on the common backplane On this backplane you have access to five pairs of banana jacks red and black and five coaxial BNC connectors All black banana jacks and the outside contacts on the BNC connectors are grounded and are thus electrically equivalent The red banana plugs and the center conductors of the BNC connectors are all routed to each of the plug in bread board modules In addition 15V 5V and OV DC power connections are also available on each breadboard Fig A 1 shows the location of the common connections on the breadboards 51 52 APPENDIX A BREADBOARDS BNC1 BNC2 BNC3 BNC4 BNC5 CO O mi a OG BP BP2 BP3 BP4 BRS All BNC BP connections ooo oeeoo have a common ground cose oeoo ooe oO 6 6 cee Power connections extend 9 9 GEeeeo GEeeoo o 9 0 0 Q o o Q 0 0 only to middle of board p ceeeo o 0 oO c o o o oo 0 oO 0 oO eo Q 0 0 Pins are grouped in rows 9 p Geeeo o o 0 0 c 9 0 0 0e 0 0 on AME a ee ee ee he 15V
52. g sponge The reliability of your project depends greatly on the quality of your solder connections Please review the reference materials on soldering techniques provided on the course web site they contain illustrations that may give you a good idea of what is expected The following guidelines are a brief summary e Each time that you make a solder joint begin by cleaning the tip of the soldering iron with the moistened sponge then tin the iron by applying a small amount of solder to the tip This procedure will result in better transfer of heat from the iron to the parts to be soldered e Apply the tip of the iron where the component lead and the PC board copper trace meet so that both are heated at the same time Apply the solder to the side opposite the tip Do not touch the solder with the iron tip When both the lead and the trace are sufficiently hot the solder will melt and form a connection This may take one or two seconds Apply only sufficient solder to cover the joint e Withdraw the tip without disturbing the solder joint and let the joint cool A good joint will be smooth and shiny and show a visibly solid connection between the copper trace and the component lead When insufficient heat is applied to a joint the solder will fail to flow around the connection and will bead and form globules resulting in a dry joint To correct this reheat the joint until the solder melts apply a touch more solder and let cool e
53. ght with the part number facing you and the three legs facing downward From left to right the legs are identified as E B C The placement of these legs should conform with the markings on the PC board Generally the three legs are clearly marked on the transistor body Add these transistors to the PC board If you are not sure as to the proper orientation of the transistors ask the instructor 1 Install the five keypad switches SW2 to SW6 Q Install keypad resistors R17 R13 R14 R16 R18 R20 Be careful to place these resistors at their proper location otherwise the keypad will not function properly Check their resistance with an Ohmmeter The reading should be within a couple of percent of the required value 1 With the project board component side up insert a 40 pin IC socket for the PIC controller at location U5 on the board One end of an IC socket is usually indexed with a cutout or some other identifying mark to properly orient the removable IC in the socket Be sure that the socket orientation corresponds with the indexed outline on the board o With the board solder side up and the IC socket flush with the surface of the board solder the four corner pins to the board Check that the socket is properly seated If it is not gently apply pressure to the socket and apply some heat to the pin to melt the solder and seat the socket Solder the remaining pins being careful to not apply too much solder and short out adjacent pins
54. i meters to protect against errors like this D Switch the meter back to voltage mode Pull down and insert a 1 kQ resistor in series with the battery Position the resistor directly over an existing wire and release the resistor will insert itself Vary the resistance is the voltage on the multi meter changing Hint you may have to go to pretty high R values Try to find the point where the meter reads exactly of the nominal battery voltage In EWB the batteries are always ideal sources however the meters are not The point of s voltage is where the internal resistance of the non ideal meter is exactly equal to the external R Explain your result and provide a calculation to support your observation 4 EXPERIMENT 1 INTRODUCTION TO ELECTRONICS WORKBENCH 1 4 Review of basic electronic components While logic gates are all that is required to construct a digital circuit you will find that to interact with your digital system some familiarity with the behaviour of basic electronic components such as resistors diodes and transistors is necessary e The resistor is a linear circuit element in that it obeys Ohm s Law V I R where a voltage V across a resistance R causes a current I to flow through the resistor The resistor is typically used in series with another component as part of a voltage divider or to limit the circuit current e The ideal diode can be visualized as a switch that is turned off R co until a positive vo
55. ing guide device in tight spaces 9 3 A chaotic dripping tap The incessant drip dripping sounds of a leaky tap drive us insane late at night but a precise measurement reveals that the time interval between drips is almost never perfectly periodic In fact drop formation is influenced by a number of factors including the size of the previous drop As a result the dripping tap is an example of a chaotic system and a variety of dynamic measurements can be performed demonstrating period doubling attractors and other features typical of the dynamics of chaos An infrared LED detector pair interfaced to a microcontroller is sufficient to perform time between drips measurements that can be logged and analyzed 9 4 A universal digital knob There is a distinct advantage to being able to turn a knob to control something there is a tactile feedback that tends to feel natural to the operator and reduces the error rate However analog knobs based on variable resistors or capacitors have limited range and are mechanically unreliable they are also quite expensive On the other hand an electronically controlled counter that uses 9 5 AN LCD BAR GRAPH 49 up down buttons is awkward to manipulate and provides no tactile feedback One interesting compromise can be realized if a digital rotary encoder can be used to control a digital register value In general these devices generate a series of pulse that can be used to increase decrease a coun
56. left mouse and moving the cursor to outline a rectangular region the release the buttton and save the output to a file You can conveniently include the schematic instrument settings and output as well as descriptive text A textbox from the Miscellaneous submenu as one capture that can be saved and imported to a document Do not append printouts to the end of the lab report 1 3 Real and ideal meters 1 Consult your notes or the Web to determine the internal configuration of a real non ideal voltmeter and ammeter Pull down a battery in the sources bin move the mouse over the icons and a bubble with the name appears and a multi meter in the instruments bin into the worksheet Double click the multi meter icon for a close up view Verify the multi meter is in voltage mode t e that is highlighted Practice connecting disconnecting the wires and moving the components around the worksheet Move the components to verify that the wires are properly connected to them and that the electrical circuit is complete Connections display a black dot When do you see a positive reading on the meter a negative one D While the meter is connected to the battery switch it into the current mode by pressing Al What happened Why do you never do this to a real meter Refer to the internal circuit for a real ammeter to describe what happened Click the multimeter Settings button for further insight What is the most common way used in real mult
57. ltage forward bias V gt Vn is applied across the terminals The negative diode terminal cathode is represented by the flat line When turned on a voltage V n will be present ascoss the diode and R 0 The value of Von is 0 6V for a Silicon diode 0 3V for a Germanium diode and 1 5V for a GaAs red light emitting diode LED Continuous diode currents much greater than 10 20 mA will cause LEDs to burn out e The bipolar transistor is a three terminal device The terminal with the arrow is the emitter the opposite terminal is the collector and the centre terminal is the base This device is a current amplifier in that the emitter collector current igg p x igg the base emitter current times the transistor current gain 3 The base emitter junction behaves like a diode so that igg 0 and Rog until Veg gt Von As Ver increases Rog 0 In the digital domain a transistor is typically used to switch on off devices that require more current than a logic gate is capable of supplying such as LEDs lamps and relays You can incorporate these components in the circuit as shown Use a scope from the Instru ments menu to monitor the base and collec tor voltages Drive it with a 10 V peak to peak square wave centered at zero volts with a fre quency of less than 1 Hz The round indicator probe turns on solid color at 2 5V The LED 10 k Ohm is on when the arrows are filled in D Start the simulation and
58. m behave as expected Consult the help menu to obtain more information on the PIC opcodes and utility subroutines that are available for you to use Showkey asm Program to priridi tanita bbb 05 4 0 5 0 5 0000 oR ep A eee eee KEYSAVE equ 0x20 Be eii a dian ie aa ae haa ss ao CoP OES EEE Be NS BES AE clrf PORTD A E R Si aU ER aR aa ain ete des oe ae Suara readkey call Getkey BY cele MAUS O Se VOY EEEE Vas Gece aye ee ecloverh ea aks movwf KEYSAVE E E E E E E E E E E E sublw T a S a ladies oo A btfsc STATUS Z EEE EELE E A E goto readkey E Sagas Rasta a Bact ace aa ase aaah a6 ae a de sulla la 8 coh movf KEYSAVE W Sm ay Ras avec hacSasve Bas vaste va A E EN EN E EE ve Tonese aha aaa algae movwf PORTD r E RG E E E E E sublw 2 EREEREER EEEE EEEE EEEE I EEE btfss STATUS Z miele i a hes etas aa a y te eae add goto readkey EE REE EE E 04 Slav awe teinouas as aceon return required if code follows main program 42 EXPERIMENT 8 PICLAB PROGRAMMING In the above example a simple return from a subroutine instruction return is being used In the picl convention the entire user code is assumed to be a subroutine of the PICLab loader and so at the very end of the code an automatic return is always inserted for you This is why your one line programs like bsf PORTD 7 worked just fine even though they did not have a return operation However you must insert an explicit return at the end of every subroutine that you yourself wri
59. machines in the Physics cluster under the name of PhysicaLab It is a local Tcl Tk script that acts as an interface into the same engine that drives the web based Physica Online Recently a new graphical user interface version of physica called eXtrema has become available from exsitewebware com extrema in both Linux and Windows versions You may want to download and install it on your home computer On line physica tutorial A quick way to get into physica is through the on line tutorial created here at Brock 59 56 PLOTTING WITH physica e log on to a Linux workstation e open a web browser and an 80x24 shell window a terminal icon side by side point the web browser to www physics brocku ca doc physica and type physica in your shell window a separate graphical output window will open up and the shell window will display the PHYSICA prompt proceed at your own pace e You will likely want to use your favourite text editor to create small macro command files You may want to arrange all windows side by side for convenience Remember to not resize the graphics window of physica with a mouse use a resize command at the PHYSICA prompt
60. micromechanical switch Use the virtual oscilloscope to verify that your calculations are correct and the pulse width is as expected 5 3 CIRCUIT REALIZATION 21 common anode 7Seg Vcc Vec BCD decoder driver Ze Nec mt Ip vcc He 330 Ohm Vcc 2aej c oF NAV 3 LT OG 14 N rf __ 4 BI RBO OA 3 A V S 4 RBI OB Ew Sp oc A vw 1k Ohm 100 k Ohm ZA op Hev one shot debouncer Vcc 8 GND 0E 2A A I ond yee p ae TRI ols m e 7447 OUT THR m RES CON j a A E EE lt 1k Ohm up down counter ET l 1B VCC 1uF 2 QB A 3 QA CLR 4 j 4 DOWN BO p S UP Co p 2 4 ac LOAD p t __ an Cc aa m GND D 7 L 74192 Figure 5 2 A real circuit involves additional details 5 3 Circuit realization Additional components required one 555 timer IC one 74192 decimal counter IC one 7447 BCD to seven segment decoder driver one seven segment LED common anode miscellaneous capacitors and resistors momentary switches You are now ready to implement the real circuit In addition to the de bouncing of the real me chanical switches the magic BCD encoded seven segment display has to be made out of separate components a 7447 encoder driver IC current limiting resistors and a common anode sev
61. n the OR example in your report 2 3 A binary counter 5V 5V 5V 14 h3 2 1 fro 8 R J J 7400 3 a 12 11 CP CLR K CP CLR K 13 A 1 l2 3 l4 5 lel 7 B cA 5V 5V 5V 5V 5V 2 Dual JK Master Slave R Flip Flop 7473 Zr 5V ee set f if f Switch Debouncing Y 2 Y 2 Y Circuit cathode of LED h is the short wite Figure 2 4 A binary counter 10 EXPERIMENT 2 LOGIC GATES The binary counter shown in Figure 2 4 is made using a 7473 dual JK flip flop chip This chip has several modes of operation depending on the the signal levels at the J and K inputs With J K 5 V the flip flop performs a toggling function so that the Q output changes logic state whenever a high to low transition occurs at the CP clock pulse input Thus the Q output changes state at one half the rate of CP The switch resistors and NAND gates make up a pulse generator that drives the counter input When an electromechanical switch makes or breaks a contact a series of pulses lasting some 1 5 ms are generated This effect is known as contact bounce and is very undesirable in fast digital circuits Since the gate delay and hence response time of flip flops is around 10 ns many pulses would be counted every time a switch is toggled resulting in an erratic count To debounce the switch two NAND gates connected as an RS latch are used Apply the above i
62. n the lab book is expected All of your individual observations and measurements must be included Here you can capture the screen output and settings from the digital oscilloscope and save it to your lab report Following every lab you are required to submit a lab report analyzing and summarizing the data and the experimental procedures The lab report should be typed single sided and submitted in a clear report cover document folder The grading is based on the following iii e overall neatness and coherence in the structure of the report e completion of all the required simulated and experimental steps e inclusion of printouts data tables circuit and waveform sketches e thoughtful and understandable responses to the guide questions e adherence to the designated lab format You will find it most efficient to open a wordprocessor document at the start of the lab and then enter observations data screen captures of circuits graphs and oscilloscope traces as you proceed with the experiment This way the overall structure of the lab report will have been created and can be easily enhanced with further details and insights A lab report should start with an overall statement of purpose of the experiments Then for each exercise include a schematic diagram of the circuit and graphs of the waveforms observed formula derivations a description of the theoretical behaviour of the circuit and comparison with your actual observations and ans
63. nal schematic Implement the circuit shown in Fig 4 2 Check other outputs as well Which output stage provides the 1 kHz signal Also determine the propagation delay for one of the flip flop stages of this ripple counter Q Use HP function generator to provide a 250 Hz trigger signal to the oscilloscope and monitor the output of your crystal oscillator HP signal generators contain high precision internal frequency standards with very low phase drift Carefully adjust the function generator s frequency until your oscillator s signal appears completely stable then wait a few minutes and observe if the frequency has drifted See if cooling your circuit with a gentle air flow causes changes Why would it be a bad idea to use a 555 circuit as the frequency source for your timer circuit 4 3 Review operational amplifiers e The two triangle shaped devices internal to the 555 chip are operational amplifiers The output of an Op Amp is given by V A x V V_ where V and V_ are the voltages present at the two inputs and A is the open loop voltage gain of the Op Amp This gain is typically very large i e A 10 so that a tiny difference in the input voltages will cause V to swing between the limits set by the power supply voltages of th Op Amp EXPERIMENT 4 OSCILLATORS AND CLOCK CIRCUITS 18 V ee R1 Vc 8 Discharge 7 R2 Low on Reset sets Q low Comparator outputs Threshold 1 high when V gt V Control 5 R S
64. nformation along with the truth table for the RS latch to describe how the circuit debouncing is preformed Again the Web or your textbook may be a useful resource D Assemble the switch resistors gates and LED for the debounce circuit following the assembly procedures previously outlined Document how the output of the debounce circuit behaves as the switch is toggled Is this the behaviour of an RS latch 1 Add the counter circuit components Graph the input pulses at CP from the debounce circuit and the values of 2 and 2 below one another and using the same arbitrary time scale Switch movement B gt A gt B represents a single input pulse Advise the demonstrator when the counter is working and demonstrate its operation D Remove the debounce circuit from the CP input of the counter Reconnect the switch as follows A to 5V B to OV and the common point to CP Toggle the switch Graph the output states of the counter as you did before Describe your results Remove the switch from the CP input Connect CP to one of the BNC1 contacts on the breadboard Connect a cable from the BNC1 connector to the SYNC output of the signal generator This output is a 0 5V square wave that can be used to clock digital circuits Set the function generator frequency to 1Hz and describe the circuit behaviour o Slowly increase the frequency and note when each of the three LEDs changes from a noticeable on off flickering to a steady glow Estimat
65. ng the outputs of adder bits 0 3 to zero When the reset line makes a low to high transition the multiplier word is latched into bits 4 7 of the accumulator while bits 0 3 are loaded with zeros AND gate outputs for bits 4 7 are set to zeros and the clock circuit is enabled Note that each bit in the accumulator is wired to the next most significant bit of the full adder array Hence a left shift operation is being performed every clock cycle The multiplicand is always added to the accumulator as a four bit value that is the four most significant bits added are zero This is exploited to reduce the total gate count the four bits of the multiplier value can be initially loaded into the upper four bits of the accumulator without affecting the result as these bits will have shifted out of the accumulator On every low to high transition of the clock the multiplicand or zero if the appropriate mul tiplier bit is zero is added to the accumulator value and stored in the accumulator latches The deciding condition is the state of bit 7 of the accumulator which of course is reporting each of the bits of the multiplier as it gets shifted out of the upper four bits of the accumulator which had been pre loaded there by the reset Note that the order in which the multiplier bits are processed is MSB to LSB as the accumulator contents are shifted left At the same time the shift counter is incremented In this case use of an up counter is preferable
66. nnected in series with a current limiting resistor R 2 3 A BINARY COUNTER 9 Most integrated circuit IC chips contain a number of logic 5 v ee ee gates In this experiment the 7400 chip used contains four sep 5 i arate NAND gates Make sure you start by making the power connections ground and 5 V For each of the above circuits an AND gate an XOR gate gt D x a half adder a gated latch 1 Draw the circuit neatly Label your gate connections with t R L E EJ lel C the corresponding chip gate pin numbers as shown in Fig GND ure 2 4 This will ease the process of circuit assembly and Feme 03s Pincut OF 67400 troubleshooting o Assemble the circuit Begin by installing the 7400 chip Connect the power pins Connect the gates and switches with jumper wires Add the LEDs Verify the correct orientation of each LED by connecting one end of the current limiting resistor to the LED anode and the other end to 5 V If the LED glows it is inserted correctly Re connect the resistors as shown 1 Verify the circuit operation by testing all input combinations record the results as a truth table Remember that you can simulate these circuits using Electronics Workbench data sheets that describe the logic states and expected operation of all these chips are available on the Web D Include Boolean explanation as done i
67. of the board is silk screened with the various part outlines and corresponding part IDs All soldering is done on the opposite or bottom side of the board You will be using version 2 0 of the PICLab board an updated of version 1 0 that no longer supports the RS232 interface or 28 pin PICs but includes a prototyping area with several types of surface mount pads as well as a TLV431 voltage reference for the A D converter Space for two user configurable trimmer potentiometers is also included Table 7 1 PICLab board v2 0 basic parts list CF ren a 1002 resistor R9 current limiting resistor 1 47KQ resistor current limiting resistor 1 IN914 diode glass blocking diode during programming 1 N O mini switch normally open reset switch U5 1 1 1 1 H 40 pin IC socket for PIC 16F877 controller 1 1 1 ad hao 20 00MHz crystal microcontroller oscillator crystal id 22 pF capacitor PIC oscillator capacitors 1 0 1F capacitor decoupling capacitor 1 10 pin header ICSP Program interface 1 40 pin IC socket for RT DDC563DSA 7 segment displays C8 8300 resistor RNI Display segment current limiting resistors NAOT transistor QL QT Display segment digit driver transistors A 22KO resistor RRS Display transistor base current limiting resistors 5 NJO mini switch SW2 SW6 Keypad normally open keypad switches 10K M resistor RI Keypad voltage divider pullup resistor TTA 7RO resist
68. ogram the list of patterns into the generator s table to produce a sequence of seven segment digits from 0 to 9 Set the pattern generator into a loop mode over the list you entered and verify that the display appears to count from 0 to 9 D For an extra challenge expand the list to 16 entries one for each of the hexadecimal digits 6 EXPERIMENT 1 INTRODUCTION TO ELECTRONICS WORKBENCH 1 6 Bit combinations control a 7 segment LED display The previous section demonstrated a brute force approach usually the job of controlling the individual segments of a 7 segment display is given to an integrated circuit called BCD to 7 segment encoder D From the DEC menu in Flip Flop bin place a Generic BCD to seven segment decoder into your circuit between the sequencer and the 7 segment LED display The conventional order is that on the BCD side the bit A is the least significant bit and that the seven segment display inputs are A to G left to right Make sure that the LT lamp test BI blanking input and RBI ripple blanking input are tied high i e attached to a Vee 5V Modify the sequencer program to count up from 0 to 9 and then back down to 0 a total of 19 steps Lab Report Submit a lab report consisting of the work undertaken during this lab waveforms observed formula derivations a description of the theoretical behaviour of the circuit and comparison with your actual observations and answers to the pertinent que
69. oose R1 R2 and C for an output of 1 kHz with as close to 50 duty cycle as you can Verify that the circuit works and note the values you have chosen Use the digital oscilloscope to monitor the output signal as well as the voltage at the capacitor and record these waveforms What is the range in the duty cycle of the 555 output Consider the changes additions that you might make to the circuit to produce output pulses of a relatively small duration for example a 10 duty cycle 15 16 EXPERIMENT 4 OSCILLATORS AND CLOCK CIRCUITS Y Explore what happens if you disconnect the control voltage CV input pin 5 and instead connect it to a wiper of a 10 kQ potentiometer that is connected between 15V and ground This circuit is called a voltage controlled oscillator Comment on the variation in duty cycle as you vary the control voltage How does the off time vary with changes in CV Explain your observation using the fact that the oscillation is based on the exponential discharging of a capacitor 4 2 Crystal oscillator and ripple counter Additional components required one 4 096 MHz crystal one 4060 ripple counter IC chip 1 kQ and 1 MQ resistors 10 pf and 39 pF capacitors Crystal oscillators are available in a variety of frequencies which are determined by manu facturing them to exacting size and shape spec ifications Often one encounters unusual val 8 7 6 5 4 3 2 1 ues such as the 4 096 MHz crystal provided
70. or Ris Keypad SW2 voltage divider resistor 1 1 EE reistr Rit Reve S05 veliage divider resister 2 270 resistor RILRT2__ USB__ current limiting resistors USB B type connocior 2 Table 7 1 lists the components required to assemble a USB powered printed circuit board These 32 EXPERIMENT 7 PICLAB PROJECT BOARD component are through hole parts inserted and then soldered at their proper location The PIC itself and the two 7 segment LED displays are socketed the components are inserted into the socket in the final step of the assembly Several other components such as a voltage regulator and power jack are required if the board needs more than 250mA of current to operate In this case a battery or AC adapter can be used Table 7 2 PICLab board v2 0 optional on board power supply parts list TE en 1 0A solid state fuse yellow disc circuit breaker A 00F7T0V capacitor i D1 i 00E 25V capacitor TNA004 Di Power polarity reversal diode O Spm header Power USB VDC power select___ a 05 TROP Power SV regulator SS O Power jack 2tmm f Power external 9VDC voltage mpat Soldering You will be using a variable temperature soldering station for all your soldering Turn on the power and set the temperature so that the green LEDs light up but not the red ones The soldering station may take a minute or two to reach the selected temperature While you are waiting moisten the tip cleanin
71. other time depending on the availability of equipment Plagiarism When you are working closely with your partner it is understood that parts of the lab reports will appear similar however plagiarism will result in a zero for that report It is your responsibility to consult the section on Academic Misconduct of the University Calendar prior to the first lab session iv Conventions used in this manual Q Whenever you see a paragraph marked off with this symbol it indicates an experimental step You are expected to perform one or several operations and write down your results and observations in the lab book When you encounter this symbol it indicates a question or a problem You are expected to perform the necessary calculation using pen and paper and to provide a written answer and possibly a brief explanation in your lab book before you proceed to the next stage of the experiment Plotting and fitting with physica An integral part of every lab is an analysis of the results and it is best done with the help of a scientific visualization plotting fitting computer program The Physics Department uses a plotting and fitting package called physica written at the TRIUMF accelerator in Vancouver BC This is the recommended software for use in the analysis of experimental data and in the preparation of lab reports theses and scientific articles The main physica engine is an old fashioned piece of software in the sen
72. p through the sequence and observe how the pattern of indicators connected to the sequencer output lines follows 1 Logic probes are ideal sensors of the logical state of any wire in the circuit a more realistic way is to use light emitting diodes LEDs Drag several LEDs or an eight LED bar graph indicator into your circuit and connect the anodes of each LED diode to the outputs of the sequencer Connect the cathode ends to ground through 220 Q resistors These serve as current limiting resistors without them the LEDs would burn out almost instantly Enter a two line sequence AA 55 which will create an illusion of lights running up your LED bar graph Modify your sequence to create a single running light 00000001 00000010 00000100 etc o Replace the LED bar graph with a 7 segment LED display Assemble the circuit shown The 7 segment LED display has seven inputs that each control the lighting up of a particular CHHSOOOO 00000005 segment of the display Thus for each pattern of bits produced by the pattern generator there appears a pattern of lit LED segments The labeling convention and pin assignment for each segment can be found in the help menu for the device 0000 xxxx 9 Figure 1 3 Controlling a 7 segment LED 1 Map each segment to an output of the word generator then generate a table of bit patterns that correspond to the 7 segment repre sentations of the decimal digits 0 9 Pr
73. r non linear fits and a proper statistical evaluation of convergence e g x7 e you must bring your own laptop computer to the lab e the instructor may not be able to help not being familiar with the quirks of your software What is made available to you in the lab is a powerful scientific plotting and fitting package called physica written at the TRIUMF accelerator in Vancouver BC This is the recommended software for use in the analysis of experimental data and in the preparation of lab reports theses and scientific articles The main physica engine is an old fashioned piece of software in the sense that it has a command language and requires typing of commands at the prompt and not clicking a mouse and using visual widgets On the other hand it is easy to learn its numerical engine is an extremely powerful one and a macro language allows you to automate many tasks using only a text editor In order to harness the full power of physica you may need to spend some time learning its command language In addition Physica Online is a web based interface into physica which may prove adequate for most tasks It is fairly self explanatory and can be invoked by pointing a web browser to www physics brocku ca physica For more advanced tasks the web based Physica Online provides the expert mode which does allow access to full capabilities of physica A stand alone version of Physica Online is also installed on all the Linux
74. r proper operation any sequential circuit requires e initialization to some known state and e aclock to sequence the logic In the circuit of Fig 6 1 a low on the reset line clears the accumulator so that the initial sum is zero The rising edge of the clock latches the data into the accumulator and an add store operation is performed each clock cycle The clock signal can originate from a switch that single steps the circuit or automatically from a square wave oscillator To perform the addition of each bit a full adder is used The carry output of each adder ripples to the carry input of the adder representing the next most significant bit The output of the adder is latched by a D type flip flop with clear The word to be added multiplicand provides one input to the adder the other input consists of the data currently stored in the accumulator 23 24 EXPERIMENT 6 FOUR BIT MULTIPLIERS m bit 3 bit 2 bit 1 bit 0 Li amp amp O carry out step run fi Ain clock reset Figure 6 1 A 4 bit adder with accumulator D Simulate this circuit Try some input word values and step the circuit repeatedly by hand What happens when the 4 bit capacity of the accumulator is exceeded Given that the logic components used have a 10 ns propagation delay what is the total propagation delay for the circuit Which signal path determines the op
75. re and picl software is running as a PICLab simulator In this mode your programs are executed on a virtual duplicate of the PICLab hardware o Check that the port is set to dev ttyUSBO Click on the connection icon it should change to a connected pair of plugs and a message Connected to PICLab at 57600 Baud should be displayed in the status box The PIC simulator window disappears T From the Options menu click the Reset PIC button The PICLab board should momen tarily display the 8888 and then blank just as if you had pressed the Reset button on the board Once all of the above tests have been successfully carried out and all problems have been resolved your PICLab is ready for use NAME PRINT STUDENT ID LAB DATE GRADE Experiment 8 PICLab programming Brock s own PICLab is the development board package that will be used in several experiments in this lab The microcontroller used in PICLab is the Microchip PIC16F877 20 or PICI6F887 With a 20 MHz oscillator most instructions require 200 ns 4 clock cycles to execute In addition to the PIC itself the PICLab board contains power supply display and interface circuits necessary to communicate with the board via a USB port of a Linux workstation or PC PICLab bootloader A small bootstrap utility program has been pre loaded into the memory of your PICLab and a computer program called picl has been written to provide transparent communica
76. resented together Many circuits combine both elements All digital circuits require some time for an output to respond to a change of state at the input This is known as the propagation delay of the circuit This delay needs to be taken into account in order to to properly analyze circuit behaviour and timing 3 1 Divide by two flip flop A D flip flop propagates the state of its input D to the outputs Q and Q at the rising edge of the clock pulse Da E CP The output is held after CP goes low In the feed a back mode where Q is connected back to D as shown i it will take two clock cycles to return to the initial state Thus a single D flip flop performs a simple divide by two oocooocoocoo0oo0oo0oo0o0000000 D Assemble the circuit shown Use the logic analyzer to monitor the timing of the divide by two oper ation The logic analyzer samples the logic states Figure 3 1 A 2 flip flop of the input lines at a rate determined by an in ternal or external clock Check by double clicking on the analyzer icon that this internal clock is se lected and set to a frequency of 5 10 times that of the input signals otherwise you may not see any meaningful analyzer output 1 Add the extra connection between the Q and the logic analyzer to monitor the second output as well Make a record of the analyzer timing diagram D Increase CP and the analyzer clock to observe and
77. rt value in W to 7 segment hex digit PRERA N display hex digit for A D bits 8 9 seter eed loop code 46 EXPERIMENT 8 PICLAB PROGRAMMING 8 6 Utility subroutines and data output There are several pre loaded subroutines available for use as part of your programs Click on the help menu and browse the Routines subdirectories You should become familiar with these routines they are bug free and will make your programming task much easier Several of these routines make the output and conversion of data a simple matter For example the Bin2BCD routine takes the 16 bit binary value stored in the file registers WH and WL and converts it to a five digit signed or unsigned decimal value stored in registers DecO Dec4 The BCD2LED routine converts and outputs this result to the 7 segment display Alternately the contents of DecO Dec4 can be sent to the PICLab output window in picl as an ASCII string by calling the BCD2TCL routine or to the LCD display by calling the BCD2LCD routine The PICLab LCD display uses the ASCII character set These routines require parameters to be set prior to execution To send to picl a single ASCII character stored in W use the TxByte routine To send a value in W in the range of 0 9 as the corresponding ASCII decimal character use the TxDigit routine The Hex2TCL routine outputs the value in W as a 2 character hexadecimal string while the Dec2TCL routine outputs the value in W in the valid range o
78. s then terminate and return control to the user You can use labels to make the program more readable The equ directive assigns a value to a label The following code will flash the LED COUNT times and terminate Flash asm Program to flash LED on and off a specified number of times COUNT_REG equ 0x20 use register 0x20 to count 0 1F are reserved COUNT equ 0x10 count value to be put into the count register DELAY equ Oxff Wait this many tics 150us ea movlw COUNT put a count value into the accumulator movwf COUNT_REG put accumulator into the count register flash bsf PORTD 7 turn on LED segment movlw DELAY pass DELAY count to function Wait call Wait bef PORTD 7 turn off LED segment movlw DELAY pass DELAY count to function Wait call Wait decfsz COUNT_REG decrement count skip over the next goto flash instruction when file register 0 Another way to terminate a loop is to check for a certain condition and run until it is satisfied such as when the user presses a button The Getkey subroutine reads the keypad and returns in W a value of 2 6 if a button is pressed otherwise a value of 7 is returned The STATUS register maintains the state of several flags that can be tested to alter the program flow The zero flag Z is set when the result of an operation is zero and is cleared otherwise D Document the following code and test the algorithm by running the program What does the program do Does the progra
79. s disabled when the PIC is reset To define an interrupt service subroutine that will be remembered by the PIC until redefined add the UserISRon directive following your ISR subroutine code 8 5 ANALOG TO DIGITAL CONVERSION 45 UserISRon Scan seg set Scan 7seg as user ISR and enable interrupt The ISR routine will only execute while your program is running To test some ISR code you can program a one line instruction e g here goto here to execute an infinite loop the ISR routine will execute until the PICLab board is reset The user ISR routine can be turned on and off from within your program with the following instructions bcf Flags USERISR reset user ISR flag disable user ISR bsf Flags USERISR set user ISR flag enable user ISR 8 5 Analog to digital conversion The PIC can sample one of eight input channels with a 10 bit resolution To perform an analog to digital conversion ADC an input channel is selected A delay follows to allow the input voltage to be sampled A start of conversion flag is set to begin the ADC and another flag is set when the conversion is completed The data is then ready to be used The ReadAD subroutine performs all of the above tasks Load the W register with the number of the input channel and call the routine After 50us the lower eight bits of data are returned in the WL file register and the two most significant bits are in WH The Getkey routine reads A D channel 0 and uses the three most
80. se that it has a command language and requires typing of commands at the prompt and not clicking a mouse and using visual widgets On the other hand it is easy to learn its numerical engine is an extremely powerful one and a macro language allows you to automate many tasks using only a text editor e A simple to use interface to Physica available only on the Physics Department computers is the Physicalab data acquisition and plotting software used in the first year Physics labs Open a terminal window and type Physicalab at the command prompt to invoke the program e In addition Physica Online is a web based interface into physica which may be accessed from any web browser It is fairly self explanatory and can be invoked by pointing a web browser to http www physics brocku ca physica e For more advanced tasks Physicalab and Physica Online provide an expert mode which allow access to full capabilities of physica In order to harness the full power of physica you may need to spend some time learning its command language i References In addition to your course textbook numerous excellent introductory electronics books exist and you are encouraged to refer to them often Some selected titles are listed below with Brock Library calling numbers shown where appropriate Other references such as manufacturers data books and the equipment manuals should be consulted as needed most of them are available online The web page of the
81. sed to lock the circuit so that a valid result can be read Optional Simplify this serial summing circuit Hint consider how the upper bits bits 4 7 of the multiplicand enter the 8 bit adder circuit as well as what happens to the overflow pattern of bits 0 3 6 2 A shift add multiplier With some minor changes to our 8 bit adder circuit a more efficient multiplication circuit can be realized Binary multiplication can be performed in a manner analogous to the well known procedure of decimal multiplication by hand in which a series of shifts and additions one for every digit of the multiplier yield the product In binary multiplication this procedure is simplified by the fact that each binary digit has only two possible values 0 and 1 To perform binary multiplication e initialize to zero both the accumulator and the loop counter e shift the contents of the accumulator this is equivalent to a multiplication or a division by 2 e for each bit of the multiplier in sequence if the bit is a one add the multiplicand to the accumulator otherwise skip this step i e add zero e repeat the above steps until the loop counter has counted the number of bits in the word 26 EXPERIMENT 6 FOUR BIT MULTIPLIERS 4x4 product bit 7 hit 6 bit 5
82. ses decrement the counter to zero and the circuit is then locked so that no further changes take place until a reset pulse restarts the circuit and another multiplication is performed 6 2 A SHIFT ADD MULTIPLIER 25 8 bit product aT bit 7 bit 6 bit 5 bit 4 ic bit 3 bit 2 bit 1 bit 0 D OF ae O O jo d bd Bj He tt Se SZ Tali e T gt o e s d kd 4 ad ad ad t a H ei ad ad ad xf o ap H r ii fa fa fa Fa a fa A fa J 00 G b g ee eB o 8 o b g 8 o B o n gt m gt aor aor aor aor aor or Vt EF o ky Z Ep ie o fete te i ee P L F c E E Heo n 3 2 a l l 1 p 4 4 b b 4 bit multiplier clock reset 4 bit multiplicand e Ia Figure 6 2 A 4x4 bit summing multiplier D Modify your 8 bit adder circuit to match Fig 6 2 and verify its operation D Describe using truth tables and timing diagrams the operation of the logic used to load the counter with an initial value and the logic u
83. st up to date information Currently the ITS operates several computer labs within the Department of Physics B203 and H300 are the two largest ones all of them deploying identical Linux based workstations Logging on to any of them with your Brock assogned Campus username password will bring you into the exact same environment and all the files in your home directory will be available to you they are stored on one central network server accessible from all workstations equally In addition this course makes a heavy use of a circuit simulation program called Electronics Workbench EWB also known as the National Instruments Multisim due to a recent corporate change Unfortunately there is no Linux compatible version of this software and it has to be run from a separate central Windows server You access this server using the same Campus user name password D Log on to the Linux workstation using the Campus username password T Click on the OpenSUSE icon at the bottom left of your screen then click on Science followed by Electronics Workbench to open login window to the Windows server Enter the same Campus username password and a Windows Desktop will appear D Click on the EWB5 icon to start the program Move around and examine the menus and controls Pausing a cursor over an unknown item should bring up a bubble of a description of what the item is The simulation is controlled by the on off switch at the top right corner of the scr
84. stions The presentation of your results should be organized and complete your diagrams titled and referenced so that someone who is not familiar with the experiments would have no difficulty understanding what was done At the end of the lab report include a brief Conclusions section that summarizes and compares the results from the simulated and hands on portions of the lab and a discussion of any problems encountered and insights gained Note The lab report for this experiment is due before the beginning of the next scheduled lab session one week later Late labs receive a zero grade To satisfy the lab component for the course all lab reports must receive at least a passing grade Be sure to have read and are familiar with the preface section of this lab manual Note You need to prepare for the next experiment by designing several logic operations using NAND gates Be sure to have these circuits ready to use NAME PRINT Experiment 2 Logic Gates STUDENT ID LAB DATE GRADE The principles of digital logic govern the operation of all modern computers The objec tive of this experiment is to become familiar with basic logic gates and their appropriate logic truth tables 2 1 Circuit assembly techniques You will be using a breadboard to assemble and test your hands on circuits provides a convenient and organized way of implementing circuits making quick component changes and providing trouble free circuit connections On
85. stors and y directions and in a digital one it effectively presses one of four switches one for each of x y x and y or eight if each direction has two positions indicating half and full strength This information is processed by a microcontroller and converted into an electronic signal that is then sent to a remote microcontroller that in turn uses it to control the state of an action device Along the way the command signal may be manipulated in some way for example to ensure that an unstable or a dangerous configuration is not accidentally requested by a user or that all transitions from one state to another are optimally smooth and do not exceed a certain rate of change in an aircraft this might result in a dangerous to pilot g force A single microcontroller with a joystick at its input and a servomotor at its output is enough to create a simple fly by wire controller that demonstrates most of the essential features of such a system 9 7 Decoding an infrared remote control Infrared pulses can be used to carry signals wirelessly across short distances in line of sight config urations These are used in a variety of devices from TV remote controls to shared office printers to toys such as the Furby capable of some form of communication with its own kind To build or debug an IR enabled communications device it is useful to have a decoder of what these devices are sending through the IR into a sequence of readable ASCII co
86. t none of the pins are out of alignment and being bent until it is fully seated in the socket If the chip resists installation see the instructor Q Install the two dual 7 segment display ICs Note the correct orientation The decimal points of the display should be at the bottom of the display toward the PIC Install the first display IC flush with the right side of the socket The second display is installed flush with the first The two leftmost pins of the socket will remain empty That is to say the displays should appear offset slightly to the right on the socket Q Noting the correct orientation install the MAX232 serial interface chip into the 16 pin socket following the directions outlined above 36 EXPERIMENT 7 PICLAB PROJECT BOARD Reconnect power to the project board If the PIC circuit is functioning properly the PICLab will test the 7 segment display by displaying the number 8888 The PICLab will then blank the display and wait for user input Press the Reset button The PICLab should once again display 8888 then blank the display If this happens the PICLab microcontroller and display circuits are functioning as expected The keypad now needs to be tested The state of the keypad is encoded as specific voltage levels at ADC input channel 0 The switches are organized as follows SW2 2 SW3 3 SW4 4 SW5 5 SW2 SW3 1 SW6 6 none 7 The keypad test routine verifies that the ke
87. te and at the end of your main program if any code follows it An extra return somewhere in the middle of the code can also be used as a simple debugging tool Upon encountering such a premature return the program will terminate pass the control to the PICLab loader and it in turn will update all of the open windows of picl with the current values of various registers memory contents etc You will then be able to examine the current status of your PIC and decide if the code you wrote is doing exactly what you intended it to do You may also execute a call Break instruction to update picl with the recent values from the PIC and to continue program execution This subroutine is not a part of the PIC instruction set but is made available through the utility loader function set You can use the symbol in a blank line as a short form for call Break Note The call Break and instructions may cause unexpected program behaviour when placed in your code following a conditional branch instruction or as part of a jump table In addition to the simple returns the PIC instruction set has other flow control instructions that allow one to take some programming shortcuts For example addwf PCL F instruction increments the current program counter PC by a value stored in the W register before proceeding to the instruction stored at that location In this way an indexed goto statement is implemented The retlw is a combined load and return instruction
88. ter value in the best designs some accounting of the speed of the turning is made so that slowly turning the shaft produces individual pulses while turning it more rapidly also increases the step size generating more pulses per unit rotation a form of adaptive ballistic control One of the most inexpensive ways to implement such a universal digital knob is by interfacing a stepping motor from an old floppy drive to a microcontroller 9 5 An LCD bar graph A companion project to the previous one is a way to display the value of a register as a simulated bargraph using the special block graphics characters available on an LCD display interfaced to a microcontroller Some button action up down scrolling through a list of registers or simply one of five single button selection of registers selects a particular variable register the digital knob changes its value and the LCD displays the name address of the variable and its value with a simulated LCD bargraph providing a visual representation of the value As a stand alone project an LCD bargraph could be used as an add on feature to a straightforward digital voltmeter 9 6 A joystick controlled servomotor Fly by wire controls physically separate the controller a joystick and the devices that are perform ing the action servomotors Instead of mechanical or hydraulic linkages an electronic connection is made In an analog joystick the position controls two variable resi
89. th the assembly thoroughly read the following instructions in their entirety Before soldering any components to the project board familiarize yourself with the proper location and orientation of all the components Verify that you are installing the correct parts as specified in Table 7 1 If you are uncertain as to the value of a particular resistor measure it with a multimeter As you go along you may find it useful to mark off the steps already completed D Locate the 100 Q reset circuit resistor R9 and verify the value with an Ohmmeter Bend the leads at a right angle where they meet the body of the resistor You can do this by applying pressure to the end of the resistor body with the tip of your finger Be sure to make a tight angle otherwise the part will not fit into the board Avoid bending the leads many times as they will likely break off With the PC board component side up install resistor R9 flush with the PC board then bend the leads outward to hold the part in place Turn over the PC board and solder the resistor leads Snip the excess lead lengths after the solder joint has cooled 1 Repeat the procedure to install the 47 KQ reset circuit resistor R10 D Install diode D4 The diode has a glass body with a thin black band at one end to indicate the negative cathode The band should be oriented in the same direction as the part outline on the PC board Solder and trim the leads D Install the reset switch SW1 The pins have
90. tion and pro cessing of the input data and the output of results or control signals that are required to give your design its planned functionality Consider also the enhancements that time permitting could be made to your design to increase the usefulness or capabilities of your project 2 proposal the proposal consists of a written and oral presentation of the tentative PIC design project that you have selected The proposal outlines what you are planning on doing how you are planning to do it and the difficulties that you expect to overcome It should be the end result of some significant amount of time spent thinking about the practical issues involved in the implementation of the project the analysis of several possible alternative hardware software solutions to the problem specifically in terms of the merits of the different approaches 3 development this involves the experimental process of attempting and achieving the milestones set out in the design proposal and will likely involve a mixture of the assembly of mechanical and electronic components as well as software programming A part of this process involves the resolution of problems expected and unexpected that arise during the development of any prototype system A detailed dated documentation of the development process must be preserved This is a record of the steps undertaken to accomplish the end result as well as the design choices that were attempted but proved to be
91. tions with the PICLab board picl IDE picl is an Integrated Development Environment of the PICLab board It allows you to write assembler programs compile and download them to the memory of the PIC and to examine the state of the PIC memory or registers during the debugging process picl can also provide a real time text and graphical display of data sent by your running program picl also includes a PICLab simulator Implemented in software is most of the functionality of PICLab including the internal hardware of the microcontroller and the external hardware elements such as the LED display keypad LCD display and serial port The user subroutines that are preloaded on PICLab are also simulated in software Hence your code developed with the simulator should run as expected on the real PICLab With the simulator you can easily single step through your code and monitor the outcome of each instruction Further Virtual Pic allows you to view how an instruction is executed inside the PIC and the path that your data follows on every cycle of the PIC clock You can easily switch execution of your code between the simulator and the PICLab board by making or breaking the PICLab connection PICLab schematic Fig 8 1 provides an overall block diagram of the PICLab board showing the essential connections between the PIC itself and the other components of the PICLab board Together with the picl help menus and the PIC reference documentation see th
92. ue how does this value change with every transition of the clock How does the value at the Q outputs change Explain Determine the propagation delay for each of the flip flops and then the total propagation delay of the entire ripple counter of Fig 3 2 What is the maximum clock rate that should be applied to this circuit How do the outputs behave as the circuit is overclocked beyond this maximum frequency Explain this behaviour in terms of propagation delays Predict the propagation delay of a 10 bit ripple counter iHow does the propagation delay affect the size of a ripple counter Is this a desirable characteristic in a counting circuit 3 3 ONE OF EIGHT DECODER 13 3 3 One of eight decoder A key device needed in multiplexing demultiplexing applications is a binary to one of eight decoder similar to the one shown in Figure 3 3 Q Assemble the decoder as shown drive it with the binary counter from the previous section and verify that only one of the lights at a time in sequence are turned on by the binary counter Use the analyzer to record the complete timing diagram for the 3 bit binary to one of eight decoder including the clock pulse waveform Given that all digital components in EWB exhibit by default a 10 ns propagation delay what is the propagation delay from the clock to each of the decoder outputs Verify this by observing the analyzer output How could you decrease the propagation delay of the counter decoder
93. wers to the pertinent questions The presentation of your results should be organized and complete your diagrams titled and referenced so that someone who is not familiar with the experiments would have no difficulty understanding what was done At the end of the lab report include a brief Conclusions section that summarizes the results and discusses problems encountered and insights gained The purpose is to reach the synthesis stage to give you a chance to establish intermediate milestones in your learning Completed lab reports will be collected at the beginning of the next lab thus you have a full week to complete your lab reports However you will find it easier to do the write up within one or two days of the end of the lab while the details are still fresh in your mind There will be no time extensions given for late submissions Late labs receive a zero grade all labs must be completed with a passing grade to satisfy the lab component for the course Be prepared Some of the experiments will require the full 3 hour lab period therefore it is essential that you are fully prepared before attending your lab session e Arrive on time Your lab starts at 2 00 pm sharp e Be sure you have read through the experiment in its entirety at least once before arriving Your partner cannot be expected to wait for you Failure on the above two points can result in you working alone time permitting or being asked to make up the experiment some
94. xity of these circuits is explored In digital electronics there are usually several ways to express a design in hardware Generally the various approaches to solving the problem involve a trade off between the speed of operation clock cycles or gate delays and the hardware complexity gate count of the resulting circuit To implement an elementary mathematical operation namely the multiplication of two 4 bit binary numbers several possibilities exist a brute force repeat addition with counting a shift and add scheme similar to the decimal multiplication scheme we learned in the elementary school etc Some algorithms naturally lend themselves to a sequential implementation using counters to sequence or loop the hardware a specific number of times and an array of flip flops known as an accumulator to store intermediate results Some other algorithms are naturally parallel and their implementations can be in the form of a purely combinatorial circuit Hybrid versions also exist What is the range of binary values that multiplying two 4 bit numbers can yield How many bits may be required to store display the result of such an operation 6 1 A summing multiplier The most basic multiplication algorithm simply involves repeated addition of a multiplicand with the number of times the addition is performed specified by a multiplier 7 e 3 5 5 5 4 5 A possible implementation of this algorithm in a 4 bit adder circuit is shown in Fig 6 1 Fo
95. ypad resistors were correctly installed by displaying the switch number on the LED display when a switch is pressed The following procedure causes PICLab to enter a diagnostic mode that displays keypad data Press and hold one of the keypad switches Press and release the reset button The num ber 8888 should be displayed followed by a number that corresponds to the keypad button currently pressed D Release the switch The number 7 should appear Press each of the keypad switches in turn and verify that the number corresponding to the switch is displayed If the number output does not match the switch pressed an incorrectly valued resistor has been installed Simultaneously press SW2 and SW3 the digit 1 should be displayed Press the reset button to exit the diagnostic routine Now you can test the operation of the PICLab USB serial interface The PICLab board is controlled and programmed via a connection to the picl software running on a host computer picl can automatically detect the presence of the PICLab board More on this later D With the PICLab board connected to the host computer login to your workstation and type picl at the command prompt The picl software should start by opening a PICL window on your desktop as well as a PIC simulator window At the top left corner of the PICL window an icon displaying a single plug shows that the PICLab board is not currently communicating with the picl softwa

Download Pdf Manuals

image

Related Search

Related Contents

BENDIX TCH-013-001 User's Manual  98-05111 R2 BoomPilot User Guide 107 Software.indd  AlcoSafe KX6000  SOLUTION Q2-FIX  TE-074P - Bekafun  User`s Manual of ISaGRAF Embedded Controllers  60007 MANUAL (tri).qxd    

Copyright © All rights reserved.
Failed to retrieve file