MICROBOARD ADVANCED MANUAL

Size: px
Start display at page:

Download "MICROBOARD ADVANCED MANUAL"

Transcription

1 MICROBOARD ADVANCED MANUAL Revised and edited by David Zeibin, Summer 2001 Based on documents by Ben Bathgate, Mike Cumming, Patrick Pilarski, and Paul Bartosek Special thanks to Dr Chris Backhouse

2 HOW TO USE THIS MANUAL Designed to supplement the MicroBoard Manual, the MicroBoard Advanced Manual showcases the new incarnation of the MicroBoard, explains LCD interfacing and low-level PIC programming, and introduces a novel approach to programming: artificial neural networks. Section 1 introduces the newest addition to the MicroBoard family: a bleeding edge micro-controller board based on Microchip s PIC16F877, the grand daddy of the PICs. The new board makes previously difficult tasks relatively easy and opens up a new chapter in PIC-related applications. Section 2 touches on a subject that, if not given a hand, could take you weeks to get working flawlessly on your own. Interfacing the PIC with an LCD screen can be a formidable task, but the EE401 team has designed a method that can be implemented fairly easily on either board. In fact, the new MicroBoard has been designed to interface with an LCD daughter board using only 14-pin ribbon cable (the subroutines have been programmed into DEBUG877.HEX. Section 3 introduces some really low-level programming. But as far as programming in assembler code goes, this manual contains nothing extra from that contained in the PIC16F87x data sheet (available at The built-in modules featured on the PIC such as the UART, the ADC, and the PWM, including all three built-in timers are outlined here and the following sections explain how each module is controlled at the base level allowing you to program the PIC to suit your needs exactly. Section 4 is a short one but could be extremely useful: an explanation of interrupt programming on the PIC. Interrupts can be used in your project as an elegant alternative to never-ending loops. Section 5 is the king of clever PIC programming. Using a brilliant program written by Gregory Stevens, you can bypass a fair amount of logic programming. An artificial neural network, when given a set of input data and its corresponding set of output data, trains your robot and gives it the skills to anticipate and respond to data it has never seen before. This manual, however, holds no guarantees: if you choose to venture here, you do so at your own risk. The TAs will not be expected to understand everything in here and neither will you. The basic MicroBoard Manual will instill enough knowledge in you to attain a great mark. But if you re willing to take a chance and experiment, or are just eager to learn more, this manual should help you on your way. Be forewarned though, I ve jumped straight into the lingo and there is not much cross-referencing. This manual has not received the same scrutinizing eye of design. It is a collection of pieces with minimal order. Before you go any further, read the entire MicroBoard Manual; you re going to need the background. Again, good luck. David Zeibin August 2001

3 TABLE OF CONTENTS 1 THE NEW MICROBOARD (PIC16F877) Design & Assembly Programming LCD SCREEN Using the LCD Screen with the PIC16F873 MicroBoard...3 Using the LCD Screen with the PIC16F877 MicroBoard A Few Things to Try Writing to the LCD Screen in Hosted Mode Writing to the LCD Screen in Autonomous Mode PIC BUILT-IN MODULES Timer Modules Timer Timer Timer UART Pulse Width Modulator Analog-to-Digital Converter Serial Peripheral Interface INTERRUPT PROGRAMMING ARTIFICIAL NEURAL NETWORKS: AN INTRODUCTION Getting Things Ready Setting Up and Training Nets Connecting the External Hardware More Ideas...14 APPENDICES APPENDIX A. MICROBOARD (PIC16F877) SCHEMATIC...15 APPENDIX B. MICROBOARD (PIC16F877) BOARD LAYOUT...16 APPENDIX C. UART SAMPLE CODE...17 APPENDIX D. ADC SAMPLE CODE...18 APPENDIX E. SPI PROGRAMMING GAMEPAD CONTROLLER...20

4 1 THE NEW MICROBOARD (PIC16F877) Believe it or not, the second-generation MicroBoard is a much more capable control system outfitted with many of the same features but designed in a more elegant fashion. This bleeding-edge board, driven by a MicroChip PIC16F877, has a dedicated SPI connector, programming capabilities, 8kB of program memory (in contrast with the PIC16F873 s 4kB), eleven extra I/O pins (banks D and E), and easy integration with an SK10 board. Although the old board is extremely capable, the new board is a considerable refinement. Connecting an LCD screen or setting up an SPI bus are much easier tasks, and the addition of a programming module allows the new MicroBoard to program other PICs or be programmed by another PIC16F877-based MicroBoard. Figure 1-1: PIC16F877 pin-out diagram 1.1 DESIGN & ASSEMBLY For a full schematic and board layout, refer to Appendices A and B. Of course, this being the MicroBoard Advanced Manual, the documentation on the new MicroBoard is sparse at best. One who decides to use this board must understand the schematic and board layout, and know what each part does and how it interacts with the other parts. As such, there is no step-by-step walkthrough explaining how to put the PIC16F877-based MicroBoard together. However, given a parts list (the instructor should be able to give you one with the kit) and the schematic and board layout, one should have relatively few problems constructing this robust piece of hardware. 1.2 PROGRAMMING The PIC16F877 is programmed using a PICSTART Plus programmer in almost the exact same manner as the PIC16F873. Be sure to select the appropriate chip from the pull-down menu before you begin programming the PIC. You may also need to change the header in the program you re compiling. A DEBUG program has been written for the new MicroBoard also. Fear not, however; it operates in the exact same manner as the previous version of DEBUG.HEX. See the MicroBoard Manual for the complete list of Hosted mode commands. One of the greatest strengths of the new MicroBoard, however, is its ability to program other MicroBoards through the Hosted mode. Using a 7-pin ribbon cable, connect the programming pin-out on a DEBUG enabled MicroBoard to the programming pin-out of the MicroBoard that is to be programmed. The following chart describes the function of each programming pin: Section 1 The New Microboard (PIC16F877) Page 1

5 Connector Pin Programmer Board Connection Connection on Application Board 1 RB3 Low Voltage Programming Control RB3 If low voltage programming is desired (optional) RB6 Program Clock RB6 Program Clock In 2 3 RB7 Program Data RB7 Program Data In 2 4 Direct Connection to MCLR MCLR 5 Programming MCLR Output No Connection 6 GND GND 7 VCC 5V power supply VCC 1 1 The programmer board can supply power to the application PIC chip, but beware that the output power through to the application board should be limited to 100mA. 2 The connections to RB3, RB6, and RB7 on the application board should be disconnected from other application circuitry during programming. The sole connections should be to the programming board only. 3 See Microchip s documentation website for a description of Programming Modes. Using low-voltage programming mode means that the board you re programming does not need to be connected to an external power source. Once everything is connected, attach the serial cable to the DEBUG-enabled MicroBoard, start up a HyperTerminal session, and plug in the power to the boards (or to just the one board if you re going to use low-voltage programming mode). The Help screen should appear. Enter prog to begin the programming routine (or lprog to begin low-voltage programming). The program will display the prompt Send file. A hex file can now be sent as an ASCII text file. Choose Transfer>Send Text File and select the hex file to send. The transfer in hex file will be displayed on the screen while the programming process is underway. Once programming has finished, disconnect the programming ribbon cable and power up the application board. The newly programmed circuit should begin executing the newly installed program. Section 1 The New Microboard (PIC16F877) Page 2

6 2 LCD SCREEN Using the SPI bus and only three output pins on the PIC, the LCD helper board makes attaching an LCD screen to either MicroBoard a relatively painless task. The schematic in Figure 2-1 shows the pin-outs on the LCD helper board (all resistors are 10kΩ): Figure 2-1: LCD Screen Helper Board Schematic For reference, see the LCD screen data sheet and Section 6.4 Adding Additional Outputs Using Shift Registers in the MicroBoard Manual. For the EAGLE schematic and board layout, see the Advanced directory on the EE401 web site: USING THE LCD SCREEN WITH THE PIC16F873 MICROBOARD 1 Connect a length of 14-pin ribbon cable to the SPI connector on the LCD board. Be sure to match up the pin assignment correctly (pin 1 on the ribbon cable is signified by a small arrow). 2 Using four lengths of wire, connect RC0 to pin 14 on the other end of the ribbon cable, RC3 to pin 12, and RC5 to pin 13. If you want to use the LCD screen with other SPI devices, pin 9 is the chip select line (which will allow you to send data to the 595 shift register on the LCD board). Keep in mind that the chip select line on shift registers is active low (if you re not using any other SPI devices, connect pin 9 to ground or not at all). 3 With DEBUG.HEX programmed onto your PIC, start up a HyperTerminal session. To start up the LCD, enter lcdinit. An initialization message should appear. Use the LCD commands in the MicroBoard manual to control the LCD screen. 2.2 USING THE LCD SCREEN WITH THE PIC16F877 MICROBOARD To the right is the SPI bus pin-out diagram on the new MicroBoard. To connect the LCD screen, all you need to do is run a 14-pin ribbon cable from the MicroBoard SPI to the SPI connector on the LCD board. Start up the MicroBoard with DEBUG877.HEX, type lcdinit, and you re on your way! RC RC5 RC RC4 RD RD3 RD1 8 7 RD2 GND V GND V GND 2 1 Vcc Section 2 LCD Screen Page 3

7 2.3 A FEW THINGS TO TRY There are three parts to this example. The first task will be to simply print hello world!! to the LCD screen in host mode. This quickly becomes a fairly trivial exercise given that the functions for the LCD are already written for you (this tutorial assumes you have already burned DEBUG.HEX onto the PIC) WRITING TO THE LCD SCREEN IN HOSTED MODE 1 Begin by hooking up the LCD screen to the MicroBoard as described above. 2 Start a HyperTerminal session to begin communication with the MicroBoard (refer to Section 4 of the MicroBoard Manual for details). 3 Enter the following commands at the prompt to activate the LCD screen: >> lcdinit >> lcdclear ; this displays the ee401 screen on the LCD ; clears the initialization message >> lcdput hello ; writes hello to the first line >> lcdline2 >> lcdput world!! ; moves the cursor to the second line ; writes world!! to the second line The output on the LCD screen will be something like hello world!! NOTE: The code is not capable of outputting capital letters. Any commands entered with capitals are converted to all lowercase strings before they are parsed. However, direct s of the subroutines allow upper or lower case WRITING TO THE LCD SCREEN IN AUTONOMOUS MODE Now, we would like to perform the same feat but using the MicroBoard in Autonomous mode. All this requires is DEBUG.HEX and a little tweaking. Make sure the LCD screen is connected as in the above example. In the start initialization routine, add the lines cmdlcdinit and cmdlcdclear. Remove the main code, and replace it with the code shown below (the full source code for this example can be found at main start pagesel PAGE1 initializechip ; initialize the entire Chip to known state pagesel PAGE0 cmdlcdinit ; initialize the LCD screen and print test page cmdlcdclear ; clear the screen for us mainloop pagesel PAGE1 ; select upper memory so we can access the lcd ; functions ; send hello to the first line of the LCD movlw 0x80 ; Set output to first line sendlcdcmd Section 2 LCD Screen Page 4

8 movlw 'H' ; send "Hello" to the first line by moving sendlcdchar ; each character to the W register and ing ; "sendlcdchar" movlw 'E' sendlcdchar movlw 'L' sendlcdchar movlw 'L' movlw sendlcdchar 'O' sendlcdchar movlw 0xC0 ; set output(ddram) to second line of the LCD ; screen (character 41 I think) sendlcdcmd ; Send "world!!" to the second line in the same manner movlw movlw movlw movlw movlw movlw movlw 'W' sendlcdchar 'O' sendlcdchar 'R' sendlcdchar 'L' sendlcdchar 'D' sendlcdchar '!' sendlcdchar '!' sendlcdchar pagesel PAGE0 ; return to lower memory goto mainloop ; repeat main loop Compile your edited source code and burn it onto the PIC. Plug the PIC back into the board, connect the power and you should see the message appear. Section 2 LCD Screen Page 5

9 3 PIC BUILT-IN MODULES To make your programming less stressful, the wonderful folks over at Microchip have built several modules into the PIC. These modules automate certain processes such as timing, serial communication, pulse width modulation, and analog-to-digital conversion. Each of these modules have their own registers to control their operation; once they are set, your code will continue to execute in parallel with the operation of the modules. What you should know before reading: How to read/write from/to registers across multiple memory pages and how to test registers for single bit and entire byte values. 3.1 TIMER MODULES There are three timer modules built into the PIC, each of which has it s own uses. Timer 0 is a general-purpose 8-bit timer/counter. Timer 1 is a 16-bit counter that can be used as a counter for the capture/compare/pwm module. Finally, Timer 2 is an 8-bit timer that can provide a clock signal to the PWM module TIMER 0 Timer 0 can function as either a timer or a counter, as a timer it uses F osc/4 as a reference, and as a counter it counts the number of rising/falling edges (user-defined) on the RA4 pin. This timer module is controlled using the OPTION_REG register. The current value of the timer/counter can be set or read using the register TMR0. The timer can be scaled using a pre-scale value in the range 2 0 to 2 8. Timer 0 can also cause an interrupt when the value rolls over from FFh to 00h. The following code sample initializes the Timer 0 module to count the number of rising edges on pin RA4 and assert an interrupt when it counts 1024 of them. OPTION_REG,T0CS OPTION_REG,T0SE ; count pulses on RA4 ; count rising edges OPTION_REG,PSA ; use watchdog timer prescaler OPTION_REG,PS2 OPTION_REG,PS1 ; use a prescaler of 1:4 OPTION_REG,PS0 clrf TMR0 ; zero the counter INTCON,T0IF INTCON,T0IE ; clear any stale interrupts ; enable timer 0 interrupt INTCON,PEIE ; enable peripheral interrupts INTCON,GIE ; enable global interrupts TIMER 1 Similar to Timer 0, Timer 1 can operate as either a timer or counter, although this module has 16-bits of resolution. Using the RC0 pin the timer module can count rising edges only. The Timer 1 module is controller with the T1CON register. Since Timer 1 is a 16-bit counter, it has two registers that hold the current count value: TMR1H and TMR1L, hold the high and low byte of the counter, respectively. Another difference is that Timer 1 only has four pre-scale values in the range 2 0 to 2 3. When the timer value overflows from FFFFh to 0000h, an interrupt can be produced if the TMR1E bit is set in PIE1. The distinguishing feature of this timer module is that an external crystal oscillator can be added to provide highly accurate timing, up to 200kHz or 5µs, even while the PIC is in sleep mode. The following example shows how to use the Timer 1 module to count an arbitrary number of instruction cycles, in this case: movlw 0xB1 ; preload the timer counter with movwf TMR1H ; Section 3 PIC Built-In Modules Page 6

10 movlw movwf 0xFF TMR1L T1CON,T1CKPS1 T1CON,T1CKPS0 ; use prescale of 1:1 T1CON,T1OSCEN ; disable internal oscillator T1CON,TMR1CS T1CON,TMR1ON ; select internal clock ; turn timer on PIR1,TMR1F PIE1,TMR1E ; clear any stale interrupts ; enable timer 1 interrupt INTCON,PEIE ; enable peripheral interrupts INTCON,GIE ; enable global interrupts TIMER 2 Timer 2 is an 8-bit module and can only be used as a timer: its intended use is to provide a time base for the PWM module. When enabled, the timer counts up until it matches the value in the PR2 register, initializes to FFh on reset, and resets back to 00h. The counter can be pre-scaled by 1:1, 1:4, or 1:16. For every 1, 4 or 16 instruction cycles (F osc/4) the counter will increment by 1. Then a post-scaler can be applied to the output of the counter. For every 1-16 times the counter reaches the value in PR2 an interrupt will be asserted. The following code initializes the timer to count up to 50 and reset back to zero. Every third time it reaches 50, it will cause an interrupt: movlw 0x32 ; 0x32 = 50 movwf PR2 clrf TMR2 ; reset counter to zero T2CON,TOUTPS3 T2CON,TOUTPS2 ; set postscaler to 1:3 T2CON,TOUTPS1 T2CON,TOUTPS0 T2CON,TMR2ON ; turn timer 2 on T2CON,T2CKPS1 ; set prescaler to 1:1 T2CON,T2CKPS0 PIR1,TMR2IF ; clear stale interrupts PIE1,TMR2IE INTCON,PEIE ; enable timer 2 interrupt ; enable peripheral interrupts INTCON,GIE ; enable global interrupts 3.2 UART The Universal Asynchronous Receiver/Transmitter (UART) module communicates through two pins on the PIC: RC6 and RC7, the transmit and receive pins, respectively. While the UART is operating these two pins cannot be used as general I/O pins and must be configured as inputs (high-input impedance). Most likely you will be connecting this communications port to a desktop computer that uses RS-232 logic levels (the PIC uses TTL/CMOS logic levels). By this point in your education, you should know that RS-232 voltage ranges from 15V to +15V and TTL/CMOS ranges from 0V to +5V. To allow the PIC to communicate with such devices an RS-232 transceiver is required (the MAX232 chip on the MicroBoard). Initialization of the UART should be done using the following procedure: 1 Set pins RC6 and RC7 as inputs by setting bits 7 and 6 in TRISC to 1. 2 Write to the TXSTA register with your desired configuration; then write to the RCSTA register. Section 3 PIC Built-In Modules Page 7

11 3 Configure the baud rate generator using the SPBRG register to the desire baud rate (see the PIC data sheet for a table of values for SPBRG). 4 Finally, if you want to use interrupts to communicate, enable them by setting the RCIE and TXIE bits in the PIE1 register. At this point the UART should be properly configured to communicate with the outside world. To transmit data you must ensure that UART is not busy by checking if the TXIF bit in PIR1 is set. Next, simply write the byte you wish to transmit to TXREG and the UART will take care of the rest. The UART has received data when the RCIF bit in PIR1 is set. The data is available in the RCREG register. With interrupts enabled, the ISR will be ed when either the RCIF or TXIF bits are set by the UART. The registers related to UART I/O are described in the table below. See Appendix E UART Sample Code for initialization, transmission and reception sample code. Address Name Function 0Ch PIR1 RCIF TXIF Interrupt Status Register 18h RCSTA SPE N RX9 CRE N FER R OER R RX9 D Receive Status Register 19h TXREG Transmit Buffer Data to Transmit 1Ah RCREG Receive Buffer Received Data 8Ch PIE1 RCIE TXIE Interrupt Enable Register 98h TXSTA TX9 TXE N SYN C BRG H TRM T TX9 D Transmit Status Register 99h SPBRG Baud Rate Register Internal Clock Control Table 8-1: UART-related Registers 3.3 PULSE WIDTH MODULATOR Two pins are available on the PIC with 10-bit resolution pulse-width-modulation capabilities (RC1 and RC2). These pins also have capture and compare abilities that will not be discussed here. Pulse width modulation is used to control servomotors and with an external capacitor and resistor can be used as a crude digital-to-analog converter (see Section 4.5.2). The PWM module requires that the Timer 2 module supply a clock signal to it. This clock signal will be used to derive the period of the PWM signal. Writing to the PR2 register can set the period of the signal. Use the following formula to calculate the value of PR2 for the desired period: Period = [PR2 + 1] * 4 * T osc * (TMR2 Prescale Value) Initialization of the PWM module is done using the following procedure: 1 Clear the control bits of RC1 and RC2 in TRISC to 0 to set them as outputs. 2 Start the Timer 2 module by writing to T2CON. 3 Set the period of the PWM signal by writing to PR2; both PWM output signals must have the same period. 4 The duty cycle can be controlled individually using the CCPRxL registers for the upper 8 bits of the duty and the CCPxX and CCPxY bits of CCPxCON are the lower two bits (x denotes the PWM module to be controlled, 1 or 2). 5 Finally, enable the PWM modules using the CCP1CON and CCP2CON registers. Section 3 PIC Built-In Modules Page 8

12 To change the duty cycle while the PWM is in operation, write new values to the CCPRxL and CCPxCON registers. The changes will not take effect, however, until the current period ends and the next one begins. Furthermore, an interrupt can be generated once every time a new period starts by setting the TMR2IE bit in PIE1. Addre ss Name Function 0Ch PIR1 TMR2I F Interrupt Status Register 11h TMR2 Timer 2 Counter Register Counter Register 12h T2CON TOUTP S3 15h 16h 17h 1Bh 1Ch 1Dh CCPR1 L CCPR1 H CCP1C ON CCPR2 L CCPR2 H CCP2C ON TOUTP S2 TOUTP S1 TOUTP S0 PWM Register 1 (LSB) PWM Register 1 (MSB) CCP1X CCP1Y CCP1M 3 PWM Register 2 (LSB) PWM Register 2 (MSB) CCP2X CCP2Y CCP2M 3 TMR2 ON CCP1M 2 CCP2M 2 T2CKP S1 CCP1M 1 CCP2M 1 T2CKP S0 CCP1M 0 CCP2M 0 Control Register Duty Cycle Register Capture/Compare Register Module 1 Control Register Duty Cycle Register Capture/Compare Register Module 2 Control Register 8Ch PIE1 TM2IE Interrupt Enable Register Table 8-2: PWM Control Registers As an example, we will create a PWM DAC like in the Hosted mode examples section. This code will start the PWM module and then enter a repeating loop that does nothing: start STATUS,RP0 ; switch to page 1 TRISC,2 ; set pin as output movlw B' ' ; set PWM period movwf PR2 STATUS,RP0 ; switch to page 0 movlw B' ' ; set PWM duty cycle at ~50% movwf CCPR1L CCP1CON,5 CCP1CON,4 movlw B' ' movwf T2CON INTCON,GIE movlw B' ' movwf CCP1CON ; start TIMER2 ; disable interrupts ; start PWM loop goto loop end Section 3 PIC Built-In Modules Page 9

13 3.4 ANALOG-TO-DIGITAL CONVERTER Built into the PIC16F873 is a 10-bit analog-to-digital converter with five input channels on pins RA0 through RA3 and RA5. Since the inputs are multiplexed together, the ADC can only sample one input at a time. Also, the RA2 and RA3 pins can be used as voltage references if the signal being sampled is outside the range of the PIC supply voltage. Take the following steps to configure the ADC module for operation: 1 Set the TRISA register to all 1 s to configure the pins as inputs. 2 The ADCON0 register controls the conversion clock, ADC channel selection, and operating mode, configure it appropriately. Note: Do not change ADC channels and start a new conversion in the same write operation. 3 Similarly, the ADCON1 register selects the ADC output format and the configuration of the input pins. Once this is done the ADC is ready to sample an incoming signal. To start a conversion, set the GO bit in the ADCON0 register to 1. If the ADC interrupt is enabled, an interrupt will be ed when the conversion is complete. Otherwise, the user program can poll the GO bit in ADCON0; the ADC will set it to 0 when the conversion is complete. In the following table, the registers that control the ADC are listed (see Appendix G ADC Sample Code for initialization and operation of the ADC). Address Name Function 0Ch PIR1 ADIF Interrupt Status Register 1Eh ADRESH ADC Result Register High Byte ADC Result 1Fh ADCON0 ADC S1 ADC S0 CHS 2 CHS 1 CHS 0 GO ADO N Control register 8Ch PIE1 ADIE Interrupt Enable Register 9Eh ADRSEL ADC Result Register Low Byte ADC Result 9Fh ADCON1 ADF M PCF G3 PCF G2 Table 8-3: ADC Control Registers PCF G1 PCF G0 Internal Clock Control 3.5 SERIAL PERIPHERAL INTERFACE Interfacing with other chips using SPI can drastiy reduce the wire count in your project since all the devices will be connected to a common bus. The SPI bus operates as a master-slave system with the master device controlling all communication on the SPI bus (it determines the clock signal and the chip select lines of the slave devices). Three wires are used in the SPI bus: one input, one output, and one clock signal. Separate input and output lines allow for synchronous communication between the master and slave (they can both send data at the same time). In a typical communication cycle, the master would select the slave device it wants to communicate with and send eight pulses on the clock line. On each rising or falling (user selectable) edge the master would shift out one data bit onto the output line and shift in one data bit from the input line, which is being driven by the slave device. The PIC can operate in either master or slave mode, in master mode it sends clock signals when it wants to communicate with other chips but it must also ensure that the proper chip is selected. In slave mode the PIC will not communicate unless it s slave select line is set. To enable the SPI module on the PIC: 1 Set the SSPSTAT register: it controls the clock edge (master mode only) and several I 2 C options. Section 3 PIC Built-In Modules Page 10

14 2 Set the SSPCON register: it enables the SPI module, selects master or slave mode, and selects the clock polarity (active high/low). 3 Enable or disable interrupts as desired using the SPIE bit in PIE1. 4 Transmission in master mode is initiated by writing a byte to the SSPBUF register. When the transfer is completed, the incoming data byte will be available in the same register. Address Name Function 0Ch PIR1 ADIF Interrupt Status Register 13h SSPBUF SPI Transfer Buffer Transceiver Register 14h SSPCON WCO L SSP OV SSPE N CKP SSP M3 SSP M2 SSP M1 SSP M0 Control Register 94h SSPSTAT SMP CKE BF Control Register Table 8-4: SPI Control Register Section 3 PIC Built-In Modules Page 11

15 4 INTERRUPT PROGRAMMING Interrupt-based programming is a more efficient method than polling for events. Every time a selected event occurs, the PIC stops execution of the main program and jumps to the interrupt service routine. Once finished, the PIC returns to where it left off. Each of the built-in modules has the ability to cause an interrupt for one reason or another. The ADC, for example, can cause an interrupt when it has completed a conversion while the UART can produce an interrupt when its transmit buffer is empty or when its receive buffer is full. To enable these interrupts, the modules interrupt enable bit must be set in PIE1 or PIE2. Next, clear the PIR1 and PIR2 registers to ensure that no stale interrupt flags cause an interrupt. Then, enable global interrupts by setting both the GIE and PEIE bits in the INTCON register. When an interrupt occurs, the PIC jumps to the program memory location 0x0004, the interrupt vector. The program space available in this location is very limited so it s recommended that you place your interrupt service routine (ISR) elsewhere in program memory and just put a GOTO command in the interrupt vector space. The same ISR gets ed regardless of which event caused the interrupt; therefore, your program must check the PIR1 and PIR2 registers to see why the ISR was ed. Make sure that you clear these registers after the ISR is done otherwise the PIC will start the ISR all over again. The following program initializes the inputs RB7 to RB4 to assert an interrupt when the input level on them changes. The ISR toggles the output state of the PORTA register: START CODE 0x0000 movlw high start movwf PCLATH goto start INT_VECTOR goto ISR CODE 0x0004 ; the only command you should ; have here is a goto MAIN CODE start INTCON,GIE ; global interrupts enabled INTCON,PEIE INTCON,PBIF ; internal interrupts enabled ; clear interrupt flag INTCON,RBIE ; enable RB7:RB4 interrupt STATUS,RP0 ; set the data port, PORTA, for output mode clrf TRISA STATUS,RP0... ISR CODE ISR INTCON,RBIF ; clear interrupt flag comf PORTA,F ; toggle outputs retfie Section 4 Interrupt Programming Page 12

16 5 ARTIFICIAL NEURAL NETWORKS: AN INTRODUCTION Artificial neural networks (ANNs) are amazingly simple solutions to very complex input/output problems. Through the use of an ANN you may take a set of input data and generate a fixed set of results based on that data. The beauty of the system is that you don't have to know the function that transforms the input to the output. The network is "trained" much like you would train a dog or a mother-in-law. You provide it with a set of input data and show it what it "should" display as output. By repeating the training routine for many different sets of data, the network "learns" the proper function without you having to worry about the nitty-gritty math of the operation. What s more, you can give the network a vague set of input data, and it will generalize and provide accurate solutions to data it has never seen! It will adapt to changing circumstances, unlike more rigid digital systems. More advanced nets (such as those found in competitive learning algorithms and kohonen maps) can learn without supervision, thus classifying the input themselves and creating dynamiy changing groupings. In this way, they can learn as they go. The more they experience, the more they will adapt and modify their internal generalizations. Additional systems can be implemented to train the system based on the pain or pleasure it experiences. This allows a net to figure out if its last action was correct, and modify its behaviour accordingly. ANNs have many far ranging applications from image compression to voice recognition to autonomous vehicle control and navigation. The possibilities are endless! The human brain is the most complex example of a neural network (besides possibly dolphins, but it could be they just use theirs better), and look at all the twisted things it can accomplish! 5.1 GETTING THINGS READY ANNs offer a simple way to eliminate the need for complex programming and free up a lot of time to focus on designing some elegant hardware. Although this section is written in an instruction-like form, all of this has been completed for you already. Used the code (available on the web site) as reference when working through this section; all code modifications have been clearly documented so be sure to take some time to peruse the C and *.dat files. Start by making a main program (BOD.c) that can be used by the HP-UX communication software by Dr Backhouse. This main program will allow you to test the board using C code as opposed to the low-level assembler used thus far. Next, modify the Neural Network Utilities files by Gregory Stevens to allow interfacing with the MicroBoard. Create one function in the nndisplay.c file and one in the loadin.c file. Turn the nnwhere.c main function into an independent function to be ed from the BOD main program. This function passes a net by reference to be modified by the training routine. Another function takes this net and runs MicroBoard input data through the neurons, delivering its output to the MicroBoard input pins. 5.2 SETTING UP AND TRAINING NETS Setting the ANN up is fairly simple. At the beginning of the main nnwhere.c file (or BOD.c or any other main nnutil.c file), there is a listing of any changes you need to make to the various libraries included. For the most part, you ll only have to modify the files containing the size of the networks, the number of layers, and the number of input training sets. These are well documented in the nnutils documentation ([in the zip file and ]at the top of each file). Training the net also happens to be fairly easy. Once you ve set the number of training sets in the file nninputs.c, edit the nninputs.c and nnouput.c files. Place the input test pattern (input data) and desired output (output data). The program does not take formatting into account (you could have one big line of numbers), but for clarity s sake, divide your input/output data into matching blocks of input/output pairs. The main program will run through these files to formulate the best way to produce the output from the given input. You can set the number of times the net will be Section 5 Artificial Neural Networks: An Introduction Page 13

17 exposed to the training set at the top of the training program (nnwhere.c or BOD.c). Generally, more is better: the longer you train a net, the more accurate the results. There is a point, however, where further training will not produce a noticeable effect on the output accuracy. If you can find this saturation point, you can get the most out of the net with the least time expended. 5.3 CONNECTING THE EXTERNAL HARDWARE Simply connect your external hardware s output lines to the MicroBoard s input lines and the inputs of the circuit to be manipulated to the MicroBoard s output lines. With the programming set aside, you are free to design great arrays of high accuracy sensor hardware and complex motor/visualization devices. 5.4 MORE IDEAS There are many much more advanced ANNs out there. Some can be designed to recognize faces, encrypt data, drive cars, control robotic arm position and dynamics, and even pick out good songs based on harmony. ANNs allow you to take any input function and generate a corresponding output function; all the math is left up to the net. With enough hidden layers it s possible to perform absolutely all transforms. The human retina uses a neural net to detect light and map that pattern to the corresponding part of the brain. The same can be accomplished by an array of photocells connected to a MicroBoard (with a slight decrease in complexity of course). Nets that train themselves using the input they see as desired outputs present another possibility: these nets are able to remember and reproduce things they have seen, even from incomplete or inaccurate input data. This allows a bit of smoothing to be applied to your input data. Example: Your robot sees a person enter the lab. If that person happens to be your TA, the robot knows it must launch a small high-velocity projectile at his shiny forehead. A standard robot would refrain from shooting if your TA had changed his appearance in any way or if he was slightly off center in the robot s field of view. With an ANN-trained bot, even though your TA actually shaved and changed his clothes, he ll still be conked on the noggin by a small robotlaunched projectile. Be creative! You have a small primitive brain at your disposal (No, not your brain, the ANN). The possibilities are endless. New ANN software is being produced on a daily basis all around the world for free. A web search will turn up more than enough information to get you started. I recommend Gregory Steven's NNUTIL V1.0 as a good starting point, as well as the book An Introduction to Neural Networks by Ben Krose and Patrick van der Smagt (free in PDF format on the net). For a few examples, browse through the basic_ann and snaketurret.ann folders in the EE401 web site s advanced section: Section 5 Artificial Neural Networks: An Introduction Page 14

18 Appendix A. MICROBOARD (PIC16F877) SCHEMATIC Appendices Page 15

19 Appendix B. MICROBOARD (PIC16F877) BOARD LAYOUT Appendices Page 16

20 Appendix C. UART SAMPLE CODE #include <p16f873.inc> global global global UART InitUART InitUART PutUART GetUART CODE STATUS,RP0 ; set PORTC pins as inputs (high input impedance) TRISC,6 TRISC,7 ; disable uart interrupts PIE1,RCIE PIE1,TXIE ; initialize transmit and receive status registers movlw B' ' movwf TXSTA STATUS,RP0 movlw B' ' movwf RCSTA STATUS,RP0 ; init baud rate generator movlw 25 ; 9600 baud (see table in pic16f873 datasheet) movwf SPBRG STATUS,RP0 return ; Waits for the UART to clear the transmit buffer ; and then sends a byte out ; input: W -> char to transmit PutUART STATUS,RP0 btfss TXSTA,TRMT goto PutUART STATUS,RP0 movwf TXREG return ; Waits for a byte to be received by the UART ; output: W -> byte received by UART GetUART btfss PIR1,RCIF goto GetUART movf RCREG,W return end Appendices Page 17

21 Appendix D. ADC SAMPLE CODE #include <p16f873.inc> global GetADC global InitADC variables UDATA a dc_line res 1 ADC CODE ; Starts a conversion using the ADC and waits for ; completion ; input: W -> lower 3 bits determine which ADC line to use ; output: result is available in ADRESH and ADRESL GetADC movwf a dc_line ADCON0,CHS0 ; select ADC line to use btfsc a dc_line,0 ADCON0,CHS0 ADCON0,CHS1 btfsc a dc_line,1 ADCON0,CHS1 ADCON0,CHS2 btfsc a dc_line,2 ADCON0,CHS2 movlw 1 ; wait for ADC input to settle Delay ; ~256 us ADCON0,GO ; start conversion ADCLoop btfsc ADCON0,GO goto ADCLoop ; wait for conversion to finish PIR1,ADIF ; clear conversion complete flag return ; Initialize ADC to use Fosc/2 and input line 000 ; input line can be selected on a per conversion basis ; using GetADC InitADC STATUS,RP0 clrf TRISA ; setup PORT A for input comf TRISA PIE1,ADIE ; disable ADC interrupt STATUS,RP0 movlw B' ' ; initialize ADC movwf ADCON0 STATUS,RP0 ; put lower 8 bits of result movlw B' ' ; in ADRESL and upper 2 in movwf ADCON1 ; ADRESH STATUS,RP0 PIR1,ADIF ; clear conversion complete flag Appendices Page 18

22 return ; Delay function, uses timer0 to delay execution by an exact amount ; input: W -> delay time (W*256*4/Fosc seconds) Delay sublw 0xff ; move delay count to TMR0 movwf TMR0 clrf INTCON ; initialize timer STATUS,RP0 movlw B' ' ; 1/256 prescale (TMR0) movwf OPTION_REG STATUS,RP0 DelayLoop btfss INTCON,T0IF ; wait for overflow goto DelayLoop STATUS,RP0 ; shut timer off OPTION_REG,T0CS STATUS,RP0 return end Appendices Page 19

23 Appendix E. SPI PROGRAMMING GAMEPAD CONTROLLER This is a sample program that accesses the PICs SPI system to communicate and get information from a Sony Playstation Gamepad. The SPI section in the PIC16F87x datasheet should be read to gain an understanding of how the SPI registers are configured and used. The protocol used by gamepads for the Playstation is not well documented as it pertains to specific gamepads but an excellent document is located on the Internet ( The are many versions of gamepads, from simple ones like the one used here to force feedback and rumble pack versions. DEBUG.HEX was used to view the data returned from the gamepad. The following is a script file ed to transfer the data: spiinit output b4 input b3 clear b4 spitrans 80 spitrans 42 spitrans ff spitrans ff spitrans ff spitrans ff spitrans ff spitrans ff set b4 The set of data returned by this script is similar but not exactly the same as what is in the documentation. An amount of experimentation will be required on a project using a gamepad of this type. The following is a code example using the provided SPI subroutines in the debug code. ;************************************************************************ ; Program Header ; ; - Documentation about your program is very important for not only your information but also to guide the person marking your project ; through your thought process. ; ; The following program interfaces a Sony Playstation Gamepad ; into the SPI (serial peripheral interface) connection on Port C. ; ; The simple protocol used by the gamepad is found in the SonyPlay.txt file on the EE401 web site. ;************************************************************************ ; ; Filename: Start Date: SPIsample.asm July 10, 2001 ; Last Revision Date: July 11, 2001 ; ; File Version: 1.0 ; Author: Michael Cumming ; Company: University of Alberta ;************************************************************************ ; Files required: P16F873.inc ; 16F873.lkr ;************************************************************************ ; Notes: ;************************************************************************ list p=16f873 #include <p16f873.inc> ; list directive to define processor ; processor specific variable definitions ; ' CONFIG' directive is used to embed configuration data within.asm file. ; The labels following the directive are located in the respective.inc file. ; See respective data sheet for additional information on configuration word. CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _XT_OSC & _WRT_ENABLE_ON & _LVP_OFF & _DEBUG_OFF & _CPD_OFF Appendices Page 20

24 errorlevel -302 errorlevel -305 errorlevel -306 ; These remove unwanted warnings ; from the compile information listing ;***** VARIABLE DEFINITIONS ;**** General Variables ; No variables ;********* CONSTANTS ************* ;** Directive Data Constants BANK0 BANK1 EQU EQU 0x0000 0x0080 BANK2 EQU 0x0100 BANK3 EQU 0x0180 PAGE0 EQU 0x0000 PAGE1 PAGE2 EQU EQU 0x0800 0x1000 PAGE3 EQU 0x1800 TRUE EQU 1 FALSE EQU 0 ;********************************************************************** ORG 0x000 ; processor reset vector clrf goto PCLATH main ; ensure page bits are cleared ; go to beginning of program main start banksel BANK1 clrf TRISB ; Port B is used as an output display though banksel BANK0 ; 16 buttons are available when reading the clrf PORTB ; data from the gamepad. banksel BANK1 TRISD,1 TRISD,2 ; Ack line signal from gamepad ; Att or /Enable line to signal gamepad banksel BANK0 PORTD,1 PORTD,2 ; Ack line, initialized ; Att line, normally high pagesel PAGE1 initializespi ; Call to SPI init. routine in Page1 of Program memory pagesel PAGE0 mainloop pagesel PAGE1 PORTD,2 ; Clear Att line to reset gamepad and begin ; transfer movlw 0x01 transferspi ; return value is usually 0 movlw 0x42 transferspi ; return value is the type of controller ; many types are undocumented movlw 0xFF transferspi movlw 0xFF transferspi PORTD,2 ; Set Att line end transfer movwf PORTB pagesel PAGE0 goto mainloop ; Repeat main loop Appendices Page 21

25 ;**************************************************************** ;*** PAGE 1 Subroutines ;**************************************************************** org PAGE1 ;**************************************************************** ;******************************************************************* ; SPI Module Subroutines - Master Mode only ;******************************************************************* ;******************************************************************* ; ; Function subroutine to initialize the SPI pins. The communication protocol is set to perform data transfer on ; a rising edge clock. See spec. sheet and the Mid-range ; pic manual to see how to modify code to other protocols. ; receives: nothing ; uses: W ; returns: nothing ;******************************************************************* initializespi banksel BANK1 TRISC,3 ; Select Bank1 ; SPI CLK TRISC,4 ; SPI Data in clrf TRISC,5 SSPSTAT ; SPI Data out ; SMP = 0, CKE = 0, and clear status bits banksel BANK0 PIE1,SSPIE ; Select Bank0 ; Clear int-flags, Disable interrupts clrf INTCON ; Clear int-flags, Disable interrupts PORTC,0 PORTC,3 ; SPI chip select ; SPI CLK PORTC,4 ; SPI Data in PORTC,5 movlw 0x32 ; SPI Data out ; Set up SPI port, Master mode, CLK/64, movwf SSPCON ; Data xmit on rising edge (CKE=0 & CKP=1) return ;******************************************************************* ; Function subroutine to perform data transfer over SPI pins. ; receives: W - data to be sent ; uses: W ; returns: W - data received ;******************************************************************* transferspi movwf SSPBUF ; Start Transmission banksel BANK1 ; Select Bank1 btfss goto SSPSTAT, BF $ - 1 ; Has data been received ; No banksel BANK0 ; Select Bank0 movf SSPBUF, W ; W register = contents of SSPBUF SSPCON,SSPEN ; disable SPI peripheral SSPCON,SSPEN ; enable SPI peripheral return ; The previous 2 and instructions are ; are required for proper device operation ; as per device errata. END ; Directive 'end of program' ; Code reaching this point may perform erratiy. Appendices Page 22

Building an Analog Communications System

Building an Analog Communications System Building an Analog Communications System Communicate between two PICs with analog signals. Analog signals have continous range. Analog signals must be discretized. Digital signal converted to analog Digital

More information

ELCT 912: Advanced Embedded Systems

ELCT 912: Advanced Embedded Systems ELCT 912: Advanced Embedded Systems Lecture 5: PIC Peripherals on Chip Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering The PIC Family: Peripherals Different PICs have different

More information

MicroToys Guide: Motors N. Pinckney April 2005

MicroToys Guide: Motors N. Pinckney April 2005 Introduction Three types of motors are applicable to small projects: DC brushed motors, stepper motors, and servo motors. DC brushed motors simply rotate in a direction dependent on the flow of current.

More information

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002 Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002 Basic Specs: - 30 pins capable of digital I/O - 8 that can be analog inputs - 2 capable of PWM - 8K of nonvolatile FLASH memory - 386 bytes

More information

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester Embedded Systems Interfacing PIC with external devices Analog to digital Converter Eng. Anis Nazer Second Semester 2016-2017 What is the time? What is the time? Definition Analog: can take any value Digital:

More information

Distributed by: www.jameco.com 1-800-831-4242 The content and copyrights of the attached material are the property of its owner. 28/40-Pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data

More information

;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cblock Bank0RAM ;Temporary storage for STATUS during interrupts

;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cblock Bank0RAM ;Temporary storage for STATUS during interrupts TotPrgm2 Senior Design Program for Total Project (LED and Motor Control) Hayden Callender list P=PIC16F877, F=INHX8M, C=160, N=77, ST=OFF, MM=OFF, R=DEC, X=OFF #include P16F877.inc config(_cp_off & _PWRTE_ON

More information

Distributed by: www.jameco.com 1-800-831-4242 The content and copyrights of the attached material are the property of its owner. M PIC16F87X 28/40-pin 8-Bit CMOS FLASH Microcontrollers Microcontroller

More information

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation Physics 335 Lab 7 - Microcontroller PWM Waveform Generation In the previous lab you learned how to setup the PWM module and create a pulse-width modulated digital signal with a specific period and duty

More information

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd. PR10 Controlling DC Brush Motor using MD10B or MD30B Version 1.2 Aug 2008 Cytron Technologies Sdn. Bhd. Information contained in this publication regarding device applications and the like is intended

More information

Designing with a Microcontroller (v6)

Designing with a Microcontroller (v6) Designing with a Microcontroller (v6) Safety: In this lab, voltages are less than 15 volts and this is not normally dangerous to humans. However, you should assemble or modify a circuit when power is disconnected

More information

PIC16C77X. 28/40-Pin, 8-Bit CMOS Microcontrollers w/ 12-Bit A/D * * * * * Enhanced features. Microcontroller Core Features: Pin Diagram PIC16C774

PIC16C77X. 28/40-Pin, 8-Bit CMOS Microcontrollers w/ 12-Bit A/D * * * * * Enhanced features. Microcontroller Core Features: Pin Diagram PIC16C774 28/40-Pin, 8-Bit CMOS Microcontrollers w/ 12-Bit A/D Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions to learn All single cycle instructions except for program

More information

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 07 October 26, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Finish Analog to Digital Conversion

More information

PIC16CR7X Data Sheet. 28/40-Pin, 8-Bit CMOS ROM Microcontrollers Microchip Technology Inc. DS21993C

PIC16CR7X Data Sheet. 28/40-Pin, 8-Bit CMOS ROM Microcontrollers Microchip Technology Inc. DS21993C Data Sheet 28/40-Pin, 8-Bit CMOS ROM Microcontrollers 2007 Microchip Technology Inc. DS21993C Note the following details of the code protection feature on Microchip devices: Microchip products meet the

More information

Three-Stage Coil Gun

Three-Stage Coil Gun Three-Stage Coil Gun Final Project Report December 8, 2006 E155 Dan Pivonka and Michael Pugh Abstract: A coil gun is an electronic gun that fires a projectile by means of the magnetic field generated when

More information

8-Bit CMOS Microcontrollers with A/D Converter

8-Bit CMOS Microcontrollers with A/D Converter 8-Bit CMOS Microcontrollers with A/D Converter Devices included in this data sheet: PIC16C72 PIC16C73 PIC16C73A PIC16C74 PIC16C74A PIC16C76 PIC16C77 Microcontroller Core Features: High-performance RISC

More information

Pulse Width Modulation

Pulse Width Modulation ECEn 621" Computer Arithmetic" Project Notes Week 1 Pulse Width Modulation 1 Pulse Width Modulation A method of regulating the amount of voltage delivered to a load. The average value of the voltage fed

More information

PIC ADC to PWM and Mosfet Low-Side Driver

PIC ADC to PWM and Mosfet Low-Side Driver Name Lab Section PIC ADC to PWM and Mosfet Low-Side Driver Lab 6 Introduction: In this lab you will convert an analog voltage into a pulse width modulation (PWM) duty cycle. The source of the analog voltage

More information

TECHNICAL NOTE. A COMPACT ALGORITHM USING THE ADXL202 DUTY CYCLE OUTPUT by Harvey Weinberg

TECHNICAL NOTE. A COMPACT ALGORITHM USING THE ADXL202 DUTY CYCLE OUTPUT by Harvey Weinberg TECHNICAL NOTE ONE TECHNOLOGY WAYP.O. BOX 9106NORWOOD, MASSACHUSETTS 02062-9106781/329-4700 A COMPACT ALGORITHM USING THE ADXL202 DUTY CYCLE OUTPUT by Harvey Weinberg Introduction There are many applications

More information

Lesson 19 In-Circuit Programming

Lesson 19 In-Circuit Programming Elmer 160 Lesson 19 Overview Lesson 19 Introduction When the designer makes a new circuit, there is often some time spent in developing the software for that circuit. Removing the PIC from the circuit

More information

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ θωερτψυιοπασδφγηϕκλζξχϖβνµθωερτψ υιοπασδφγηϕκλζξχϖβνµθωερτψυιοπασδ φγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκλζ ξχϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµ EE 331 Design Project Final Report θωερτψυιοπασδφγηϕκλζξχϖβνµθωερτψ

More information

PIC16C63A/65B/73B/74B

PIC16C63A/65B/73B/74B 8-Bit CMOS Microcontrollers with A/D Converter Devices included in this data sheet: PIC16C63A PIC16C65B PIC16CXX Microcontroller Core Features: High performance RISC CPU Only 35 single word instructions

More information

PIC16F Pin, 8-Bit CMOS FLASH Microcontroller. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features:

PIC16F Pin, 8-Bit CMOS FLASH Microcontroller. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features: 28-Pin, 8-Bit CMOS FLASH Microcontroller Devices Included in this Data Sheet: PIC16F872 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions to learn All single cycle

More information

PIC16C63A/65B/73B/74B

PIC16C63A/65B/73B/74B 8-Bit CMOS Microcontrollers with A/D Converter Devices included in this data sheet: PIC16C63A PIC16C65B PIC16C73B PIC16C74B PIC16CXX Microcontroller Core Features: High-performance RISC CPU Only 35 single

More information

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory Hashemite University Faculty of Engineering Mechatronics Engineering Department Microprocessors and Microcontrollers Laboratory The Hashemite University Faculty of Engineering Department of Mechatronics

More information

EE 314 Spring 2003 Microprocessor Systems

EE 314 Spring 2003 Microprocessor Systems EE 314 Spring 2003 Microprocessor Systems Laboratory Project #9 Closed Loop Control Overview and Introduction This project will bring together several pieces of software and draw on knowledge gained in

More information

PIC16F72 Data Sheet. 28-Pin, 8-Bit CMOS FLASH Microcontoller with A/D Converter Microchip Technology Inc. DS39597C

PIC16F72 Data Sheet. 28-Pin, 8-Bit CMOS FLASH Microcontoller with A/D Converter Microchip Technology Inc. DS39597C Data Sheet 28-Pin, 8-Bit CMOS FLASH Microcontoller with A/D Converter 2007 Microchip Technology Inc. DS39597C Note the following details of the code protection feature on Microchip devices: Microchip products

More information

8-Bit CMOS Microcontrollers. PIC16C6X Features A R62 63 R A R A R Program Memory 1K 2K 2K 4K 2K 2K 4K 4K 8K 8K

8-Bit CMOS Microcontrollers. PIC16C6X Features A R62 63 R A R A R Program Memory 1K 2K 2K 4K 2K 2K 4K 4K 8K 8K 8-Bit CMOS Microcontrollers PIC16C6X Devices included in this data sheet: PIC16C61 PIC16C62 PIC16C62A PIC16CR62 PIC16C63 PIC16CR63 PIC16C64 PIC16C64A PIC16CR64 PIC16C65 PIC16C65A PIC16CR65 PIC16C66 PIC16C67

More information

Section 22. Basic 8-bit A/D Converter

Section 22. Basic 8-bit A/D Converter M Section 22. A/D Converter HIGHLIGHTS This section of the manual contains the following major topics: 22.1 Introduction...22-2 22.2 Control Registers...22-3 22.3 A/D Acquisition Requirements...22-6 22.4

More information

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Timers and CCP Modules Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu PIC18 Timers Timer2, Timer4 8-bit timers use instruction cycle clock as the

More information

PIC Analog Voltage to PWM Duty Cycle

PIC Analog Voltage to PWM Duty Cycle Name Lab Section PIC Analog Voltage to PWM Duty Cycle Lab 5 Introduction: In this lab you will convert an analog voltage into a pulse width modulation (PWM) duty cycle. The source of the analog voltage

More information

GCE A level 1145/01 ELECTRONICS ET5. P.M. THURSDAY, 31 May hours. Centre Number. Candidate Number. Surname. Other Names

GCE A level 1145/01 ELECTRONICS ET5. P.M. THURSDAY, 31 May hours. Centre Number. Candidate Number. Surname. Other Names Surname Other Names Centre Number 0 Candidate Number GCE A level 1145/01 ELECTRONICS ET5 P.M. THURSDAY, 31 May 2012 1 1 2 hours For s use Question Maximum Mark Mark Awarded 1. 6 2. 9 3. 8 4. 6 1145 010001

More information

Roland Kammerer. 13. October 2010

Roland Kammerer. 13. October 2010 Peripherals Roland Institute of Computer Engineering Vienna University of Technology 13. October 2010 Overview 1. Analog/Digital Converter (ADC) 2. Pulse Width Modulation (PWM) 3. Serial Peripheral Interface

More information

PID MOTOR CONTROLLER. Version 1.0. October Cytron Technologies Sdn. Bhd.

PID MOTOR CONTROLLER. Version 1.0. October Cytron Technologies Sdn. Bhd. PID MOTOR CONTROLLER PR24 Version 1.0 October 2009 Cytron Technologies Sdn. Bhd. Information contained in this publication regarding device applications and the like is intended through suggestion only

More information

The University of Texas at Arlington Lecture 10 ADC and DAC

The University of Texas at Arlington Lecture 10 ADC and DAC The University of Texas at Arlington Lecture 10 ADC and DAC CSE 3442/5442 Measuring Physical Quantities (Digital) computers use discrete values, and use these to emulate continuous values if needed. In

More information

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232 PIC Functionality General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232 General I/O Logic Output light LEDs Trigger solenoids Transfer data Logic Input Monitor

More information

PIC16C925/ /68-Pin CMOS Microcontrollers with LCD Driver. High Performance RISC CPU: Analog Features: Special Microcontroller Features:

PIC16C925/ /68-Pin CMOS Microcontrollers with LCD Driver. High Performance RISC CPU: Analog Features: Special Microcontroller Features: 64/68-Pin CMOS Microcontrollers with LCD Driver High Performance RISC CPU: Only 35 single word instructions to learn All single cycle instructions except for program branches which are two-cycle Operating

More information

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor Name Name (Most parts are team so maintain only 1 sheet per team) ME430 Mechatronic Systems: Lab 5: ADC, Interrupts, Steppers, and Servos The lab team has demonstrated the following tasks: Part (A) Using

More information

Interfacing to Analog World Sensor Interfacing

Interfacing to Analog World Sensor Interfacing Interfacing to Analog World Sensor Interfacing Introduction to Analog to digital Conversion Why Analog to Digital? Basics of A/D Conversion. A/D converter inside PIC16F887 Related Problems Prepared By-

More information

A Comparison of 8-Bit Microcontrollers. COP800 Byte/Words Cycles X SWAP OR A,[B] MC68HC05 LDA ROLA ROLA ROLA ROLA ADD STA 1 1 REGLO REGLO

A Comparison of 8-Bit Microcontrollers. COP800 Byte/Words Cycles X SWAP OR A,[B] MC68HC05 LDA ROLA ROLA ROLA ROLA ADD STA 1 1 REGLO REGLO A Comparison of 8-Bit Microcontrollers AN50 Author: INTRODUCTION Mark Palmer Microchip Technology Inc. The PIC6C5X/XX microcontrollers from Microchip Technology Inc., provide significant execution speed

More information

PROCESS. Object. Block diagram of our design. DISPLAY THE DISTANCE (7 segment display) PIC 16F873

PROCESS. Object. Block diagram of our design. DISPLAY THE DISTANCE (7 segment display) PIC 16F873 PROCESS ENERGIZE THE CIRCUIT PIC 16F873 DISPLAY THE DISTANCE (7 segment display) SIGNAL CONDITIONING AMPLIFYING SIGNAL (x1000) (40 db LM 741) + (20 db LM741) TRANSMITTING SIGNAL (murata MA40S T) ENVELOPE

More information

' The PicBasic Pro Compiler Manual is on line at: '

' The PicBasic Pro Compiler Manual is on line at: ' ---------------Title-------------- File...4331_encoder4.pbp Started...1/10/10 Microcontroller Used: Microchip Technology 18F4331 Available at: http://www.microchipdirect.com/productdetails.aspx?category=pic18f4331

More information

Development of a Matlab-Based Graphical User Interface Environment for PIC Microcontroller Projects

Development of a Matlab-Based Graphical User Interface Environment for PIC Microcontroller Projects Session 2220 Development of a Matlab-Based Graphical User Interface Environment for PIC Microcontroller Projects Sang-Hoon Lee, Yan-Fang Li, and Vikram Kapila Department of Mechanical, Aerospace, and Manufacturing

More information

28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanowatt Technology. Interrupts 10-bit A/D (ch)

28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanowatt Technology. Interrupts 10-bit A/D (ch) 28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanowatt Technology Low-Power Features: Power-Managed modes: - Primary Run (XT, RC oscillator, 76 A, 1MHz, 2V) - RC_RUN (7 A, 31.25 khz,

More information

Homework 9: Software Design Considerations

Homework 9: Software Design Considerations Homework 9: Software Design Considerations Team Code Name: Treasure Chess Group No. 2 Team Member Completing This Homework: Parul Schroff E-mail Address of Team Member: pschroff @ purdue.edu Evaluation:

More information

Debugging a Boundary-Scan I 2 C Script Test with the BusPro - I and I2C Exerciser Software: A Case Study

Debugging a Boundary-Scan I 2 C Script Test with the BusPro - I and I2C Exerciser Software: A Case Study Debugging a Boundary-Scan I 2 C Script Test with the BusPro - I and I2C Exerciser Software: A Case Study Overview When developing and debugging I 2 C based hardware and software, it is extremely helpful

More information

PIC16F716 Data Sheet. 8-bit Flash-based Microcontroller with A/D Converter and Enhanced Capture/Compare/PWM

PIC16F716 Data Sheet. 8-bit Flash-based Microcontroller with A/D Converter and Enhanced Capture/Compare/PWM Data Sheet 8-bit Flash-based Microcontroller with A/D Converter and Enhanced Capture/Compare/PWM 2003 Microchip Technology Inc. Preliminary DS41206A Note the following details of the code protection feature

More information

Lab 1.2 Joystick Interface

Lab 1.2 Joystick Interface Lab 1.2 Joystick Interface Lab 1.0 + 1.1 PWM Software/Hardware Design (recap) The previous labs in the 1.x series put you through the following progression: Lab 1.0 You learnt some theory behind how one

More information

Solar Mailbox project. Pictures of the Solar Mailbox

Solar Mailbox project. Pictures of the Solar Mailbox Solar Mailbox project The purpose of this project is to develop a self sufficient Mailbox (real one) that will be powered only by the sun and that will display the number of the house, but only in accordance

More information

PIC16C717/770/ /20-Pin, 8-Bit CMOS Microcontrollers with 10/12-Bit A/D. Microcontroller Core Features: Pin Diagram. Peripheral Features:

PIC16C717/770/ /20-Pin, 8-Bit CMOS Microcontrollers with 10/12-Bit A/D. Microcontroller Core Features: Pin Diagram. Peripheral Features: 18/20-Pin, 8-Bit CMOS Microcontrollers with 10/12-Bit A/D Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions to learn All single cycle instructions except for program

More information

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board IXDP610 Digital PWM Controller IC Evaluation Board General Description The IXDP610 Digital Pulse Width Modulator (DPWM) is a programmable CMOS LSI device, which accepts digital pulse width data from a

More information

PIC16F716 Data Sheet. 8-bit Flash-based Microcontroller with A/D Converter and Enhanced Capture/Compare/PWM

PIC16F716 Data Sheet. 8-bit Flash-based Microcontroller with A/D Converter and Enhanced Capture/Compare/PWM Data Sheet 8-bit Flash-based Microcontroller with A/D Converter and Enhanced Capture/Compare/PWM 2003 Microchip Technology Inc. Preliminary DS41206A Note the following details of the code protection feature

More information

PIC16F631/677/685/687/689/690

PIC16F631/677/685/687/689/690 20-Pin Flash-Based, 8-Bit CMOS Microcontrollers High-Performance RISC CPU Only 35 Instructions to Learn: - All single-cycle instructions except branches Operating Speed: - DC 20 MHz oscillator/clock input

More information

MCV18E Data Sheet. 18-Pin Flash Microcontroller Microchip Technology Inc. DS41399A

MCV18E Data Sheet. 18-Pin Flash Microcontroller Microchip Technology Inc. DS41399A Data Sheet 18-Pin Flash Microcontroller 2009 Microchip Technology Inc. DS41399A Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification

More information

Sensor Interface Using PIC12CXXX as a Sensor Interface for Metal Detection

Sensor Interface Using PIC12CXXX as a Sensor Interface for Metal Detection Using PIC12CXXX as a Sensor Interface for Metal Detection Author: Vladimir Velchev AVEX - Vladimir Velchev Sofia, Bulgaria email:avex@iname.com APPLICATION OPERATION PIC12CXXX microcontroller can be used

More information

Brian Hanna Meteor IP 2007 Microcontroller

Brian Hanna Meteor IP 2007 Microcontroller MSP430 Overview: The purpose of the microcontroller is to execute a series of commands in a loop while waiting for commands from ground control to do otherwise. While it has not received a command it populates

More information

GCE A level 1145/01 ELECTRONICS ET5

GCE A level 1145/01 ELECTRONICS ET5 Surname Centre Number Candidate Number Other Names 2 GCE A level 1145/01 ELECTRONICS ET5 S16-1145-01 A.M. FRIDAY, 17 June 2016 1 hour 30 minutes For s use ADDITIONAL MATERIALS In addition to this examination

More information

Simple Bridge Stand Alone H-Bridge Data Sheet Revision 1 August 2005

Simple Bridge Stand Alone H-Bridge Data Sheet Revision 1 August 2005 Simple Bridge Stand Alone H-Bridge Revision August 00 SOLUTIONS CUBED, LLC East First Street Chico, CA 99 phone: 0.9.0 fax: 0.9. www.solutions-cubed.com Copyright 00, LLC Simple Bridge Page Table of Contents.0

More information

GCE A level 1145/01 ELECTRONICS ET5

GCE A level 1145/01 ELECTRONICS ET5 Surname Other Names Centre Number 2 Candidate Number GCE A level 1145/01 ELECTRONICS ET5 A.M. WEDNESDAY, 12 June 2013 1½ hours ADDITIONAL MATERIALS In addition to this examination paper, you will need

More information

PIC16F62X. FLASH-Based 8-Bit CMOS Microcontrollers. Devices included in this data sheet: Special Microcontroller Features: High Performance RISC CPU:

PIC16F62X. FLASH-Based 8-Bit CMOS Microcontrollers. Devices included in this data sheet: Special Microcontroller Features: High Performance RISC CPU: FLASH-Based 8-Bit CMOS Microcontrollers Devices included in this data sheet: PIC16F627 PIC16F628 Referred to collectively as PIC16F62X. High Performance RISC CPU: Only 35 instructions to learn All single-cycle

More information

PIC16F627A/628A/648A Data Sheet

PIC16F627A/628A/648A Data Sheet Data Sheet FLASH-Based 8-Bit CMOS Microcontrollers 2002 Microchip Technology Inc. Preliminary DS40044A Note the following details of the code protection feature on Microchip devices: Microchip products

More information

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett Anatomy of a Program Programs written for a microcontroller have a fairly repeatable format. Slight variations exist

More information

PIC16C712/716 Data Sheet

PIC16C712/716 Data Sheet Data Sheet 8-Bit CMOS Microcontrollers with A/D Converter and Capture/Compare/PWM 2005 Microchip Technology Inc. DS41106B Note the following details of the code protection feature on Microchip devices:

More information

TKT-3500 Microcontroller systems

TKT-3500 Microcontroller systems TKT-3500 Microcontroller systems Lec 4 Timers and other peripherals, pulse-width modulation Ville Kaseva Department of Computer Systems Tampere University of Technology Fall 2010 Sources Original slides

More information

PIC16F627A/628A/648A Data Sheet

PIC16F627A/628A/648A Data Sheet Data Sheet Flash-Based, 8-Bit CMOS Microcontrollers with nanowatt Technology 2009 Microchip Technology Inc. DS40044G Note the following details of the code protection feature on Microchip devices: Microchip

More information

Lecture #4 Outline. Announcements Project Proposal. AVR Processor Resources

Lecture #4 Outline. Announcements Project Proposal. AVR Processor Resources October 11, 2002 Stanford University - EE281 Lecture #4 #1 Announcements Project Proposal Lecture #4 Outline AVR Processor Resources A/D Converter (Analog to Digital) Analog Comparator Real-Time clock

More information

PIC16(L)F720/ Pin Flash Microcontrollers. Low-Power Features: Devices Included In This Data Sheet: High-Performance RISC CPU:

PIC16(L)F720/ Pin Flash Microcontrollers. Low-Power Features: Devices Included In This Data Sheet: High-Performance RISC CPU: 20-Pin Flash Microcontrollers Devices Included In This Data Sheet: PIC16F720 PIC16F721 PIC16LF720 PIC16LF721 High-Performance RISC CPU: Only 35 Instructions to Learn: - All single-cycle instructions except

More information

Microcontroller Based Inductance Capacitance Meter

Microcontroller Based Inductance Capacitance Meter Microcontroller Based Inductance Capacitance Meter MUDIT AGARWAL This is the Inductance / Capacitance Meters circuit. One can easily build this LC Meter measure inductances starting from mh to 00mH, µh

More information

Mechatronics Project Kit - Getting Started Manual

Mechatronics Project Kit - Getting Started Manual Mechatronics Project Kit - Getting Started Manual 40-100-1 Mechatronics Project Kit Getting Started Manual 40-100-1 Feedback Feedback Instruments Ltd, Park Road, Crowborough, E. Sussex, TN6 2QR, UK. Telephone:

More information

ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair. Overview

ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair. Overview ME 333 Assignment 7 and 8 PI Control of LED/Phototransistor Pair Overview For this assignment, you will be controlling the light emitted from and received by an LED/phototransistor pair. There are many

More information

EE 308 Lab Spring 2009

EE 308 Lab Spring 2009 9S12 Subsystems: Pulse Width Modulation, A/D Converter, and Synchronous Serial Interface In this sequence of three labs you will learn to use three of the MC9S12's hardware subsystems. WEEK 1 Pulse Width

More information

PIC16C9XX. 8-Bit CMOS Microcontroller with LCD Driver. Available in Die Form. Devices included in this data sheet: Microcontroller Core Features:

PIC16C9XX. 8-Bit CMOS Microcontroller with LCD Driver. Available in Die Form. Devices included in this data sheet: Microcontroller Core Features: 8-Bit CMOS Microcontroller with LCD Driver Devices included in this data sheet: PIC16C923 PIC16C924 Microcontroller Core Features: High performance RISC CPU Only 35 single word instructions to learn 4K

More information

MD04-24Volt 20Amp H Bridge Motor Drive

MD04-24Volt 20Amp H Bridge Motor Drive MD04-24Volt 20Amp H Bridge Motor Drive Overview The MD04 is a medium power motor driver, designed to supply power beyond that of any of the low power single chip H-Bridges that exist. Main features are

More information

PIC16F631/677/685/687/689/690 Data Sheet

PIC16F631/677/685/687/689/690 Data Sheet Data Sheet 20-Pin Flash-Based, 8-Bit CMOS Microcontrollers with nanowatt Technology 2007 Microchip Technology Inc. DS41262D Note the following details of the code protection feature on Microchip devices:

More information

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10 uc Crash Course Joshua Childs Joshua Hartman A. A. Arroyo Whats is covered in this lecture ESD Choosing A Processor GPIO USARTS o RS232 o SPI Timers o Prescalers o OCR o ICR o PWM ADC Interupts 1 ESD KILLS!

More information

EXERCISE 4: A Simple Hi-Fi

EXERCISE 4: A Simple Hi-Fi EXERCISE 4: A Simple Hi-Fi EXERCISE OBJECTIVE When you have completed this exercise, you will be able to summarize the features of types of sensors that can be used with electronic control systems. You

More information

DS4000 Digitally Controlled TCXO

DS4000 Digitally Controlled TCXO DS4000 Digitally Controlled TCXO www.maxim-ic.com GENERAL DESCRIPTION The DS4000 digitally controlled temperature-compensated crystal oscillator (DC-TCXO) features a digital temperature sensor, one fixed-frequency

More information

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs.

Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs. Hello and welcome to this Renesas Interactive Course that provides an overview of the timers found on RL78 MCUs. 1 The purpose of this course is to provide an introduction to the RL78 timer Architecture.

More information

DS1621. Digital Thermometer and Thermostat FEATURES PIN ASSIGNMENT

DS1621. Digital Thermometer and Thermostat FEATURES PIN ASSIGNMENT DS1621 Digital Thermometer and Thermostat FEATURES Temperature measurements require no external components Measures temperatures from 55 C to +125 C in 0.5 C increments. Fahrenheit equivalent is 67 F to

More information

Unit-6 PROGRAMMABLE INTERRUPT CONTROLLERS 8259A-PROGRAMMABLE INTERRUPT CONTROLLER (PIC) INTRODUCTION

Unit-6 PROGRAMMABLE INTERRUPT CONTROLLERS 8259A-PROGRAMMABLE INTERRUPT CONTROLLER (PIC) INTRODUCTION M i c r o p r o c e s s o r s a n d M i c r o c o n t r o l l e r s P a g e 1 PROGRAMMABLE INTERRUPT CONTROLLERS 8259A-PROGRAMMABLE INTERRUPT CONTROLLER (PIC) INTRODUCTION Microcomputer system design requires

More information

Project Final Report: Directional Remote Control

Project Final Report: Directional Remote Control Project Final Report: by Luca Zappaterra xxxx@gwu.edu CS 297 Embedded Systems The George Washington University April 25, 2010 Project Abstract In the project, a prototype of TV remote control which reacts

More information

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE 9S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE In this sequence of three labs you will learn to use the 9S12 S hardware sybsystem. WEEK 1 PULSE WIDTH MODULATION

More information

Figure 1: One Possible Advanced Control System

Figure 1: One Possible Advanced Control System Control and Navigation 3 Cornerstone Electronics Technology and Robotics III (Notes primarily from Underwater Robotics Science Design and Fabrication, an excellent book for the design, fabrication, and

More information

Frequency Synthesizer Project ECE145B Winter 2011

Frequency Synthesizer Project ECE145B Winter 2011 Frequency Synthesizer Project ECE145B Winter 2011 The goal of this last project is to develop a frequency synthesized local oscillator using your VCO from Lab 2. The VCO will be locked to a stable crystal

More information

BASIC-Tiger Application Note No. 059 Rev Motor control with H bridges. Gunther Zielosko. 1. Introduction

BASIC-Tiger Application Note No. 059 Rev Motor control with H bridges. Gunther Zielosko. 1. Introduction Motor control with H bridges Gunther Zielosko 1. Introduction Controlling rather small DC motors using micro controllers as e.g. BASIC-Tiger are one of the more common applications of those useful helpers.

More information

Binary Outputs: LEDs

Binary Outputs: LEDs Diode Theory Binary Outputs: LEDs A diode allows current to flow in only one direction. A diode consists of a semiconductor pn junction: In Silicon, the number of free electrons is a constant: np n i 2

More information

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK Team Members: Andrew Blanford Matthew Drummond Krishnaveni Das Dheeraj Reddy 1 Abstract: The goal of the project was to build an interactive and mobile

More information

3.3V regulator. JA H-bridge. Doc: page 1 of 7

3.3V regulator. JA H-bridge. Doc: page 1 of 7 Cerebot Reference Manual Revision: February 9, 2009 Note: This document applies to REV B-E of the board. www.digilentinc.com 215 E Main Suite D Pullman, WA 99163 (509) 334 6306 Voice and Fax Overview The

More information

PIC16F7X7 Data Sheet. 28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanowatt Technology Microchip Technology Inc.

PIC16F7X7 Data Sheet. 28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanowatt Technology Microchip Technology Inc. Data Sheet 28/40/44-Pin, 8-Bit CMOS Flash Microcontrollers with 10-Bit A/D and nanowatt Technology 2004 Microchip Technology Inc. DS30498C Note the following details of the code protection feature on Microchip

More information

I2C Demonstration Board I 2 C-bus Protocol

I2C Demonstration Board I 2 C-bus Protocol I2C 2005-1 Demonstration Board I 2 C-bus Protocol Oct, 2006 I 2 C Introduction I ² C-bus = Inter-Integrated Circuit bus Bus developed by Philips in the early 80s Simple bi-directional 2-wire bus: serial

More information

DS1307ZN. 64 X 8 Serial Real Time Clock PIN ASSIGNMENT FEATURES

DS1307ZN. 64 X 8 Serial Real Time Clock PIN ASSIGNMENT FEATURES DS1307 64 8 Serial Real Time Clock FEATURES Real time clock counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap year compensation valid up to 2100 56 byte nonvolatile

More information

Web-Enabled Speaker and Equalizer Final Project Report December 9, 2016 E155 Josh Lam and Tommy Berrueta

Web-Enabled Speaker and Equalizer Final Project Report December 9, 2016 E155 Josh Lam and Tommy Berrueta Web-Enabled Speaker and Equalizer Final Project Report December 9, 2016 E155 Josh Lam and Tommy Berrueta Abstract IoT devices are often hailed as the future of technology, where everything is connected.

More information

IST TSic Temperature Sensor IC Application Notes ZACwire Digital Output

IST TSic Temperature Sensor IC Application Notes ZACwire Digital Output IST TSic Temperature Sensor IC ZACwire Digital Output CONTENTS 1 TSIC TM ZACWIRE TM COMMUNICATION PROTOCOL...2 1.1 TEMPERATURE TRANSMISSION PACKET FROM A TSIC TM...2 1.2 BIT ENCODING...3 1.3 HOW TO READ

More information

Section 3. Reset HIGHLIGHTS. Reset. This section of the manual contains the following major topics:

Section 3. Reset HIGHLIGHTS. Reset. This section of the manual contains the following major topics: Section 3. HIGHLIGHTS This section of the manual contains the following major topics: 3.1 Introduction... 3-2 3.2 s and Delay Timers... 3-4 3.3 Registers and Status Bit Values... 3-14 3.4 Design Tips...

More information

ZKit-51-RD2, 8051 Development Kit

ZKit-51-RD2, 8051 Development Kit ZKit-51-RD2, 8051 Development Kit User Manual 1.1, June 2011 This work is licensed under the Creative Commons Attribution-Share Alike 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/in/

More information

Design and Development of Smart. Harmonic Analyzer

Design and Development of Smart. Harmonic Analyzer Chapter - 4 Design and Development of Smart Harmonic Analyzer 4.1 Introduction: There is steady evolution in the field of generation, distribution, and use of electricity since many years. New methods

More information

AN840. PIC16F7X/PIC16C7X Peripherals Configuration and Integration INTRODUCTION A/D MODULE CONVERSION BLOCK DIAGRAM

AN840. PIC16F7X/PIC16C7X Peripherals Configuration and Integration INTRODUCTION A/D MODULE CONVERSION BLOCK DIAGRAM PIC16F7X/PIC16C7X Peripherals Configuration and Integration Authors: INTRODUCTION In choosing the appropriate microcontroller for a specific application, it is necessary to select one which includes all

More information

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC Laboratory 11 Pulse-Width-Modulation Motor Speed Control with a PIC Required Components: 1 PIC16F88 18P-DIP microcontroller 3 0.1 F capacitors 1 12-button numeric keypad 1 NO pushbutton switch 1 Radio

More information

PIC16F87/88 Data Sheet

PIC16F87/88 Data Sheet Data Sheet 18/20/28-Pin Enhanced FLASH Microcontrollers with nanowatt Technology 2003 Microchip Technology Inc. Preliminary DS30487B Note the following details of the code protection feature on Microchip

More information

CALIFORNIA SOFTWARE LABS

CALIFORNIA SOFTWARE LABS Pulse Shaping on the Palm Pilot With serial, infrared and remote control applications CALIFORNIA SOFTWARE LABS R E A L I Z E Y O U R I D E A S California Software Labs 6800 Koll Center Parkway, Suite 100

More information