C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c

Size: px
Start display at page:

Download "C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c"

Transcription

1 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c / FileName: problem1cunningham.c Processor: PIC18F4520 Compiler: MPLAB C18 v.3.06 This file does the following... Creation and Revisions: Author Date Comments Patrick Cunningham 10/21/2011 / / Header Files / #include <p18f4520.h> #include <adc.h> / Configuration Bits / #pragma config OSC = EC // EC = External 4MHz Crystal for PICDEM board only #pragma config WDT = OFF #pragma config LVP = OFF #pragma config BOREN = OFF #pragma config XINST = OFF / Define Constants Here / #define SAMPLE 100 / Local Function Prototypes / void samplefunction(void); / Global Variables / int samplevariable = 0; int RA0result; / Function: void main(void) / #pragma code void main (void) ADCON1 = 0x0E; // Set RA0 to Analog, not necessary here TRISB = 0x00; // Set PortB to outputs PORTB = 0x00; // Initalize PortB so LEDs are off // Configure the A/D convertor OpenADC( ADC_FOSC_8 & ADC_RIGHT_JUST & ADC_12_TAD, ADC_CH0 & ADC_INT_OFF & ADC_REF_VDD_VSS, 0x0E ); while (1) 1

2 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem1\problem1Cunningham.c SetChanADC(ADC_CH0); // Not necessary here ConvertADC(); while( BusyADC() ); RA0result = ReadADC(); if( RA0result <= 250 ) PORTB = 0b ; else if ( (RA0result > 250) && (RA0result <= 550) ) PORTB = 0b ; else if ( (RA0result > 550) && (RA0result <= 800) ) PORTB = 0b ; else PORTB = 0b ; / Additional Helper Functions / / Function: void sample(void) Input Variables: none Output Return: none Overview: Use a comment block like this before functions / void samplefunction() // Some function that does a specific task 2

3 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem2\problem2Cunningham.c / FileName: (change filename of template).c Processor: PIC18F4520 Compiler: MPLAB C18 v.3.06 This file does the following... Author Date Comment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/ // (Your name here) / Header Files / #include <p18f4520.h> #include <portb.h> #include <timers.h> #include <pwm.h> #include <delays.h> / Configuration Bits / #pragma config OSC = EC // EC = External 4MHz Crystal for PICDEM board only #pragma config WDT = OFF #pragma config LVP = OFF #pragma config BOREN = OFF #pragma config XINST = OFF / Define Constants Here / #define SAMPLE 100 / Local Function Prototypes / void low_isr(void); void high_isr(void); void samplefunction(void); / Declare Interrupt Vector Sections / #pragma code high_vector=0x08 void interrupt_at_high_vector(void) _asm goto high_isr _endasm #pragma code low_vector=0x18 void interrupt_at_low_vector(void) _asm goto low_isr _endasm / Global Variables / int samplevariable = 0; unsigned char PWMperiod[] = 141, 119, 105, 94, 79, 70 ; char idx = 0; 1

4 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem2\problem2Cunningham.c / Function: void main(void) / #pragma code void main (void) ADCON1 = 0x0F; // set all pins to digital TRISB = 0x01; // set RB0-RB3 to inputs RCONbits.IPEN = 0; // interrupts in compatibility mode // Configure RB0 Interrupts OpenRB0INT( PORTB_CHANGE_INT_ON & FALLING_EDGE_INT & PORTB_PULLUPS_OFF ); INTCONbits.GIE = 1; // enable global interrupts // Configure Timer 2 for PWM functionality OpenTimer2( TIMER_INT_OFF & T2_PS_1_16 ); while (1) // This area loops forever / Additional Helper Functions / / Function: void sample(void) Input Variables: none Output Return: none Overview: Use a comment block like this before functions / void samplefunction() // Some function that does a specific task / Function: void high_isr(void) Possible sources of interrupt - none Overview: / #pragma interrupt high_isr void high_isr(void) if( INTCONbits.INT0IF ) INTCONbits.INT0IF = 0; OpenPWM1(PWMperiod[idx]); // 440 Hz A4 2

5 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem2\problem2Cunningham.c // SetDCPWM1(102); // 10% Duty Cycle // Delay10KTCYx(100); // Wait 1 second // SetDCPWM1(0); // Turn Buzzer on while RB0 is pressed while( PORTBbits.RB0 == 0 ) SetDCPWM1(102); // 10% Duty Cycle SetDCPWM1(0); // Turn Buzzer off idx++; if( idx == 6 ) idx = 0; / Function: void low_isr(void) Possible sources of interrupt - none Overview: / #pragma interruptlow low_isr void low_isr(void) // Add code here for the low priority Interrupt Service Routine (ISR) 3

6 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem3\problem3Cunningham.c / FileName: (change filename of template).c Processor: PIC18F4520 Compiler: MPLAB C18 v.3.06 This file does the following... Author Date Comment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/ // (Your name here) / Header Files / #include <p18f4520.h> #include <stdio.h> #include <timers.h> #include "LCD Module.h" / Configuration Bits / #pragma config OSC = EC // EC = External 4MHz Crystal for PICDEM board only #pragma config WDT = OFF #pragma config LVP = OFF #pragma config BOREN = OFF #pragma config XINST = OFF / Define Constants Here / #define SAMPLE 100 / Local Function Prototypes / void low_isr(void); void high_isr(void); void samplefunction(void); void updatelcd(void); / Declare Interrupt Vector Sections / #pragma code high_vector=0x08 void interrupt_at_high_vector(void) _asm goto high_isr _endasm #pragma code low_vector=0x18 void interrupt_at_low_vector(void) _asm goto low_isr _endasm / Global Variables / int samplevariable = 0; char LCD_str[17]; unsigned int idx = 1; 1

7 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem3\problem3Cunningham.c unsigned int Fcurr; unsigned int tmrstart = 34285; / Function: void main(void) / #pragma code void main (void) TRISD = 0x00; // Make all D Channels Outputs (for LCD) XLCDInit(); XLCDClear(); // Initialize & Clear the LCD Display RCONbits.IPEN = 0; // Interrupts in Compatibility Mode // Configure Timer0 OpenTimer0( TIMER_INT_ON & T0_16BIT & T0_SOURCE_INT & T0_PS_1_16 ); INTCONbits.GIE = 1; // Enable Global Interrupts WriteTimer0(tmrStart); // while (1) // This area loops forever / Additional Helper Functions / / Function: void sample(void) Input Variables: none Output Return: none Overview: Use a comment block like this before functions / void samplefunction() // Some function that does a specific task / Function: void updatelcd(void) Input Variables: Output return: Overview: When called, updates the LCD with the latest age global variables. / void updatelcd(void) // Go to the start of line 1 2

8 C:\Users\cunningh\StaysOnPC\ME430 Downloads & Projects\exam2_problem3\problem3Cunningham.c // write line 1 XLCDL1home(); XLCDPutRamString(LCD_str); / Function: void high_isr(void) Possible sources of interrupt - none Overview: / #pragma interrupt high_isr void high_isr(void) if( INTCONbits.TMR0IF ) INTCONbits.TMR0IF = 0; // Reset Interrupt Flag Fcurr = idxidxidx; // Compute n^3 sprintf(lcd_str,"f( %-u) = %-u", idx, Fcurr); updatelcd(); idx++; // Increment Counter WriteTimer0(tmrStart); / Function: void low_isr(void) Possible sources of interrupt - none Overview: / #pragma interruptlow low_isr void low_isr(void) // Add code here for the low priority Interrupt Service Routine (ISR) 3

Human Response Timer

Human Response Timer Human Response Timer Matthew Beckler beck0778@umn.edu EE2361 Lab Section 007 March 29, 2006 Abstract In this lab, we create a very useful application, a human response timer. The user s reaction time is

More information

Accurate Time and Interrupts

Accurate Time and Interrupts Accurate Time and Interrupts Matthew Beckler beck0778@umn.edu EE2361 Lab Section 007 March 7, 2006 Abstract In this lab, we create a very accurate digital clock using one of the microcontroller s timers.

More information

Interrupts on PIC18F252 Part 2

Interrupts on PIC18F252 Part 2 Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2

More information

Analog Output with a Digital to Analog Converter

Analog Output with a Digital to Analog Converter Analog Output with a Digital to Analog Converter Matthew Beckler beck0778@umn.edu EE2361 Lab 007 April 5, 2006 Abstract Without help, microcontrollers can have great trouble creating analog signals. Approximations

More information

The MCU s Pulse. Internal clock or oscillator to synchronize operation. One clock cycle = 1 TOSC = 1/fOSC. t TOSC

The MCU s Pulse. Internal clock or oscillator to synchronize operation. One clock cycle = 1 TOSC = 1/fOSC. t TOSC The MCU s Pulse Internal clock or oscillator to synchronize operation V 0 t TOSC One clock cycle = 1 TOSC = 1/fOSC Clock Cycle The minimum time to perform any operation is one instruction cycle TCY 1 TCY

More information

Capture Mode of Pic18F252

Capture Mode of Pic18F252 Capture Mode of Pic18F252 PIC18F253 has two Capture/Compare/Pulse Width Modulation modules. Some devices such as ADCs, Sensors (position, velocity, accelearstion, temperature [MAX6577 converts the ambient

More information

Implementation of Temperature Sensor on PICM4520 Microcontroller

Implementation of Temperature Sensor on PICM4520 Microcontroller Implementation of Temperature Sensor on PICM4520 Microcontroller Application Note Brad Pasbjerg Design Team 7 March 30 th, 2012 1 Table of Contents Cover... 1 Table of Contents... 2 Abstract... 3 Keywords...

More information

Internet de les coses aplicat a la millora del servei de Bicing de Barcelona Pàg. 1

Internet de les coses aplicat a la millora del servei de Bicing de Barcelona Pàg. 1 Internet de les coses aplicat a la millora del servei de Bicing de Barcelona Pàg. 1 * Program of the TFG: Internet de les Coses Aplicat a la Millora del Servei de Bicing de Barcelona * /****** I N C L

More information

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language Interrupts on PIC18F252 Part 2 Interrupts Programming in C Language Programming interrupts in C language using XC8 compiler is significantly simplified compared to C18 compiler. This note explains the

More information

BME 361 Biomeasurement Laboratory Demonstration Biomedical Engineering Program University of Rhode Island June 10, 2015

BME 361 Biomeasurement Laboratory Demonstration Biomedical Engineering Program University of Rhode Island June 10, 2015 BME 361 Biomeasurement Laboratory Demonstration Biomedical Engineering Program University of Rhode Island June 10, 2015 The functional units on this demonstration bread board include a PIC18F4525 processor,

More information

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag Timer0..Timer3 Timers are pretty useful: likewise, Microchip provides four different timers for you to use. Like all interrupts, you have to Enable the interrupt, Set the conditions of the interrupt, and

More information

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE;

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE; /*********************************************************************************************/ /* BME 361 Biomeasurement Lab - PIC18F4525BT Demo */ /* Laboratories 1-8: A/D, D/A, LCD display, ECG simulation,

More information

Microchip 18F4550 Interface, Signal conditioning, USB, USB- RS-232, 16x2 LCD Interface

Microchip 18F4550 Interface, Signal conditioning, USB, USB- RS-232, 16x2 LCD Interface Emtron Technologies Pvt. Ltd. Flat No-101, B3 Wing, 1 st Floor, Divyam Hights, Gilbert Hill, Shreenath Nagar, Andheri West, Mumbai-58 +91-8080181911 E-mail: emtron.tech@gmail.com, www.emtrontech.in Microchip

More information

Speed Control of a DC Motor using Digital Control

Speed Control of a DC Motor using Digital Control Speed Control of a DC Motor using Digital Control The scope of this project is threefold. The first part of the project is to control an LCD display and use it as part of a digital tachometer. Secondly,

More information

Project Number: RF Project Description: Appendix:

Project Number: RF Project Description: Appendix: Project Number: RF09 Project Description: The WatchDuck is an accelerometer-based low cost wireless pool alarm. While the summer is coming, everybody knows how unsafe personal pools are for children: accidents

More information

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw Embedded Systems Module. 6EJ505 C Tutorial 3: using the ICD3 rev. 27.9.16 tjw Images are reproduced from Reference 1. Microchip permits the use of its images for educational purposes. Main Learning Points

More information

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation Embedded systems Exercise session 3 Microcontroller Programming Lab Preparation Communications Contact Mail : michael.fonder@ulg.ac.be Office : 1.82a, Montefiore Website for the exercise sessions and the

More information

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE;

unsigned char ReadADC() { /************* start A/D, read from an A/D channel *****************/ unsigned char ADC_VALUE; /*********************************************************************************************/ /* BME 361 Biomeasurement Lab - PIC18F4525BT Demo */ /* Laboratories 1-8: A/D, D/A, LCD display, ECG simulation,

More information

Topic 10 10/24/2010. C with Embedded Extension

Topic 10 10/24/2010. C with Embedded Extension Topic 10 C with Embedded Extension Compiler MCC 18 Microchip PICC 18 Hi-Tech Concerns in embedded C programming Limited memory resources - always use the smallest possible variable necessary Smaller data

More information

Timer 32. Last updated 8/7/18

Timer 32. Last updated 8/7/18 Last updated 8/7/18 Basic Timer Function Delay Counter Load a value into a counter register The counter counts Down to zero (count down timer) Up from zero (count up timer) An action is triggered when

More information

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background: Background: Timer2 Interrupts The execution time for routines sometimes needs to be set. This chapter loops at several ways to set the sampling rate. Example: Write a routine which increments an 8-bit

More information

Remote Controlled KitchenAid Mixer for the Clients at ADEC. Appendices. Arnaud Bacye Karina Dubé Justin Erman Matthew Martin

Remote Controlled KitchenAid Mixer for the Clients at ADEC. Appendices. Arnaud Bacye Karina Dubé Justin Erman Matthew Martin Mix Masters Remote Controlled KitchenAid Mixer for the Clients at ADEC Appendices Arnaud Bacye Karina Dubé Justin Erman Matthew Martin Table of Contents A Hardware Schematics and Boards 2 A.1 Current Schematics

More information

Timer1 Capture Mode:

Timer1 Capture Mode: Timer1 Capture Mode: Interrupt Description Input Conditions Enable Flag Timer 1 Trigger after N events N = 1.. 2 19 100ns to 0.52 sec RC0 TMR1CS = 1 TMR1IF Timer 1 Capture Mode 1 Timer 1 Capture Mode 2

More information

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission Application Note One Wire Digital Output 1 Introduction The pressure transmitter automatically outputs pressure data, and when appropriate temperature data, in a fixed interval. The host simply waits for

More information

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*the speed the cell which are less dense can float and the cell that are denser can sink*/ /*the user has five

More information

Lecture (03) PIC16F84 (2)

Lecture (03) PIC16F84 (2) Lecture (03) PIC16F84 (2) By: Dr. Ahmed ElShafee ١ PIC16F84 has a RISC architecture, or Harvard architecture in another word ٢ PIC16F84 belongs to a class of 8 bit microcontrollers of RISC architecture.

More information

ECE Homework #10

ECE Homework #10 Timer 0/1/2/3 ECE 376 - Homework #10 Timer 0/1/2/3, INT Interrupts. Due Wednesday, November 14th, 2018 1) Write a program which uses INT and Timer 0/1/2/3 interrupts to play the cord C#major for 1.000

More information

MPLAB C1X Quick Reference Card

MPLAB C1X Quick Reference Card MPLAB C1X Quick Reference Card 34 MPLAB C17 Quick Reference MPLAB C17 Command Switches Command Description /?, /h Display help screen /D[=] Define a macro /FO= Set object file name /FE=

More information

Problem Score 1 / 10 2 / 26 3A / 10 3B / 12 3C / 6 4 / code check off / 22 /2 Total /100

Problem Score 1 / 10 2 / 26 3A / 10 3B / 12 3C / 6 4 / code check off / 22 /2 Total /100 ME430 Mechatronics Examination I Page 1 Name CM Section You may use only: ME430 Mechatronics Examination I Jan. 7, 2016 Problem Score 1 / 10 2 / 26 3A / 10 3B / 12 3C / 6 4 / 12 5 code check off / 22 /2

More information

EE 361L Digital Systems and Computer Design Laboratory

EE 361L Digital Systems and Computer Design Laboratory EE 361L Digital Systems and Computer Design Laboratory University of Hawaii Department of Electrical Engineering by Galen Sasaki and Ashok Balusubramaniam Quick Overview of PIC16F8X Version 1.0 Date: 9/4/01

More information

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13) C and Embedded Systems A µp-based system used in a device (i.e, a car engine) performing control and monitoring functions is referred to as an embedded system. The embedded system is invisible to the user

More information

Lecture (04) PIC 16F84A programming I

Lecture (04) PIC 16F84A programming I Lecture (04) PIC 16F84A programming I Dr. Ahmed M. ElShafee ١ Agenda Introduction to PIC16F84A programming using C language Preprocessors and, Compiler directives Constants Variables and data types Pointers

More information

ELCT 912: Advanced Embedded Systems

ELCT 912: Advanced Embedded Systems ELCT 912: Advanced Embedded Systems Lecture 10: Applications for Programming PIC18 in C Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering Programming the PIC18 to transfer

More information

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #11: More Clocks and Timers

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #11: More Clocks and Timers ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #11: More Clocks and Timers Reading for Today: Davie's Ch 8.3-8.4, 8.9-8.10, User's Guide Ch. 17 Reading for Next Class: User's

More information

The University of Texas at Arlington Lecture 5

The University of Texas at Arlington Lecture 5 The University of Texas at Arlington Lecture 5 CSE 3442/5442 LCD Discussed in Chapter 12 RS, R/W, E Signals Are Used to Send/Receive Data on D0-D7 2 PIC PROGRAMMING IN C CHAPTER 7 Chapter 7 discusses the

More information

Table of Figures Figure 1. High resolution PWM based DAC...2 Figure 2. Connecting the high resolution buck converter...8

Table of Figures Figure 1. High resolution PWM based DAC...2 Figure 2. Connecting the high resolution buck converter...8 HR_PWM_DAC_DRV Texas Instruments C2000 DSP System Applications Group Table of contents 1 Overview...2 2 Module Properties...2 3 Module Input and Output Definitions...3 3.1 Module inputs...3 3.2 Module

More information

Flow Charts and Assembler Programs

Flow Charts and Assembler Programs Flow Charts and Assembler Programs Flow Charts: A flow chart is a graphical way to display how a program works (i.e. the algorithm). The purpose of a flow chart is to make the program easier to understand.

More information

Programmable Pet Feeder

Programmable Pet Feeder Programmable Pet Feeder Tessema Gelila Berhan 1, Worku Toyiba Ahemed 2, Tessema Zelalem Birhan 3 Tianjin University of Technology and Education (TUTE), School of Electronics Engineering, Tianjin, 300222,

More information

Microchip Corporate Applications, Aug 2005 Dennis Lehman, Corporate Applications Engineer

Microchip Corporate Applications, Aug 2005 Dennis Lehman, Corporate Applications Engineer Trouble shooting Tips for the HPC Explorer Demonstration Board Microchip Corporate Applications, Aug 2005 Dennis Lehman, Corporate Applications Engineer Here is a collection of the most common PICDEM HPC

More information

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy

More information

Interrupts. Embedded Systems Interfacing. 08 September 2011

Interrupts. Embedded Systems Interfacing. 08 September 2011 08 September 2011 An iterrupt is an internal or external event that forces a hardware call to a specified function called an interrupt service routine Interrupt enable must be set (initialization) The

More information

Laboratory 10. Programming a PIC Microcontroller - Part II

Laboratory 10. Programming a PIC Microcontroller - Part II Laboratory 10 Programming a PIC Microcontroller - Part II Required Components: 1 PIC16F88 18P-DIP microcontroller 1 0.1 F capacitor 3 SPST microswitches or NO buttons 4 1k resistors 1 MAN 6910 or LTD-482EC

More information

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller 8. Microcontroller Textbook Programming Robot Controllers, Myke Predko, McGraw Hill. Reference PIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro, John Iovine, McGraw Hill. Embedded

More information

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12 Chapter 9 Input/Output (I/O) Ports and Interfacing Updated: 3/13/12 Basic Concepts in I/O Interfacing and PIC18 I/O Ports (1 of 2) I/O devices (or peripherals) such as LEDs and keyboards are essential

More information

MicroToys Guide: PS/2 Mouse N. Pinckney April 2005

MicroToys Guide: PS/2 Mouse N. Pinckney April 2005 Introduction A computer mouse provides an excellent device to acquire 2D coordinate-based user input, since most users are already familiar with it. Most mice usually come with two or three buttons, though

More information

Final Design Report 19 April Project Title: Pneumatic Exercise Machine

Final Design Report 19 April Project Title: Pneumatic Exercise Machine EEL 4924 Electrical Engineering Design (Senior Design) Final Design Report 19 April 2011 Project Title: Pneumatic Exercise Machine Team Members: Gino Tozzi Seok Hyun John Yun Project Abstract The goal

More information

LCD. Configuration and Programming

LCD. Configuration and Programming LCD Configuration and Programming Interfacing and Programming with Input/Output Device: LCD LCD (liquid crystal display) is specifically manufactured to be used with microcontrollers, which means that

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application... Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 19, 2011 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F684A processor,

More information

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF.

Interrupt vectors for the 68HC912B32. The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. Interrupts The Real Time Interrupt Interrupt vectors for the 68HC912B32 The interrupt vectors for the MC9S12DP256 are located in memory from 0xFF80 to 0xFFFF. These vectors are programmed into Flash EEPROM

More information

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee Lecture (09) PIC16F84A LCD interface PIC16F84A LCD interface Assignment 01, 4 Zones fire controller board Assignment 02, automatic water tank controller Dr. Ahmed M. ElShafee ١ ٢ LCD LCD (Liquid Crystal

More information

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Philadelphia University Faculty of Engineering Course Title: Embedded Systems (630414) Instructor: Eng. Anis Nazer Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Student Name: Student

More information

Embedded Systems Programming and Architectures

Embedded Systems Programming and Architectures Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics

More information

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca.

The modules in this lab room are 4 line by 16 character display modules. The data sheet/users manual for the module is posted on My.Seneca. LCD Modules A common output display device used with low cost embedded systems is a character LCD display. The displays are available as complete modules with a standard microprocessor parallel interface.

More information

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two BME 4900 Page 1 of 2 Semester One Week Two These past two saw a lot of progress with the Revo stationary bike project. During Thanksgiving break Shane spent most of his time doing research for the power

More information

GPS Reader. Figure 1: RMC NEMA Tag Definition

GPS Reader. Figure 1: RMC NEMA Tag Definition Douglas Guardino GPS Reader In this project a PIC 18F452 will be used to get one sentence from a GPS and make that sentence available to another PIC. This is done because the GPS puts out a bunch of sentences

More information

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4 Overview of the PIC 16F648A Processor: Part 1 EE 361L Lab 2.1 Last update: August 1, 2016 Abstract: This report is the first of a three part series that discusses the features of the PIC 16F648A processor,

More information

EE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts

EE Embedded Systems Design. Lessons Exceptions - Resets and Interrupts EE4800-03 Embedded Systems Design Lessons 7-10 - Exceptions - Resets and Interrupts 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions Resets

More information

Microcontroller Overview

Microcontroller Overview Microcontroller Overview Microprocessors/Microcontrollers/DSP Microcontroller components Bus Memory CPU Peripherals Programming Microcontrollers vs. µproc. and DSP Microprocessors High-speed information

More information

Chapter 11: Interrupt On Change

Chapter 11: Interrupt On Change Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most

More information

UNCA CSCI 255 Exam 3 Fall 2011

UNCA CSCI 255 Exam 3 Fall 2011 UNCA CSCI 255 Exam 3 Fall 2011 This is a closed book and closed notes exam. Laptops, cell phones, and any other electronic storage or communication devices may not be used during this exam. Name: KEY If

More information

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!!

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!! THE UNIVERSITY OF THE WEST INDIES EXAMINATIONS OF APRIL MID-TERM 2005 Code and Name of Course: EE25M Introduction to Microprocessors Paper: MidTerm Date and Time: Thursday April 14th 2005 8AM Duration:

More information

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work LAB WORK 1 We are studying with PIC16F84A Microcontroller. We are responsible for writing assembly codes for the microcontroller. For the code, we are using MPLAB IDE software. After opening the software,

More information

ADC: Analog to Digital Conversion

ADC: Analog to Digital Conversion ECE3411 Fall 2015 Lecture 5b. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu

More information

Development Hardware. Target Board and In-circuit Debugger

Development Hardware. Target Board and In-circuit Debugger Development Hardware Target Board and In-circuit Debugger Development Hardware :: Slide 1 of 32 Microchip PICDEM 2 Plus Target Board Development Hardware :: Slide 2 of 32 PICDEM 2 Plus Demo Board Development

More information

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing

More information

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91460 REAL TIME CLOCK APPLICATION NOTE

Fujitsu Microelectronics Europe Application Note MCU-AN E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91460 REAL TIME CLOCK APPLICATION NOTE Fujitsu Microelectronics Europe Application Note MCU-AN-300075-E-V10 FR FAMILY 32-BIT MICROCONTROLLER MB91460 REAL TIME CLOCK APPLICATION NOTE Revision History Revision History Date 2008-06-05 First Version;

More information

Introduction to the MC9S12 Hardware Subsystems

Introduction to the MC9S12 Hardware Subsystems Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators

More information

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I. University of Texas at El Paso Electrical and Computer Engineering Department EE 3176 Laboratory for Microprocessors I Fall 2016 LAB 04 Timer Interrupts Goals: Learn about Timer Interrupts. Learn how to

More information

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing Objectives Explain serial communication protocol Describe data transfer rate and bps rate Describe the main registers used by serial communication

More information

dspic Interrupts The Interrupt Control and Staus Registers are :- ENG721-S2 Mixed Signal Processing : Hassan Parchizadeh Page 1

dspic Interrupts The Interrupt Control and Staus Registers are :- ENG721-S2 Mixed Signal Processing : Hassan Parchizadeh Page 1 dspic Interrupts The dspic30f4012 has 30 interrupt sources which 3 are external interrupts and 4 processor exception traps. There are 8 user selectable priority levels for each interrupt source. These

More information

ECE PRACTICE EXAM #2 Clocks, Timers, and Digital I/O

ECE PRACTICE EXAM #2 Clocks, Timers, and Digital I/O ECE2049 -- PRACTICE EXAM #2 Clocks, Timers, and Digital I/O Study HW3, Class Notes, Davies Ch 2.6, 5.8, 8, 9.2-3, 9.7, MSP43F5529 User's Guide Ch 5, 17, 28 Work all problems with your note sheet first

More information

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine MPLAB SIM MPLAB IDE Software Simulation Engine 2004 Microchip Technology Incorporated MPLAB SIM Software Simulation Engine Slide 1 Welcome to this web seminar on MPLAB SIM, the software simulator that

More information

Microprocessors B Lab 1 Spring The PIC24HJ32GP202

Microprocessors B Lab 1 Spring The PIC24HJ32GP202 The PIC24HJ32GP202 Lab Report Objectives Materials See separate report form located on the course webpage. This form should be completed during the performance of this lab. 1) To familiarize the student

More information

The MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function

The MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function The MC9S12 Timer Output Compare Function Making an event happen at specific time on the HC12 The MC9S12 Output Compare Function o Registers used to enable the output compare function o Using the MC9S12

More information

Capturing the Time of an External Event Input Capture Subsystem

Capturing the Time of an External Event Input Capture Subsystem Capturing the Time of an External Event Input Capture Subsystem One way to determine the time of an external event is to wait for the event to occur, the read the TCNT register: For example, to determine

More information

DEV-1 HamStack Development Board

DEV-1 HamStack Development Board Sierra Radio Systems DEV-1 HamStack Development Board Reference Manual Version 1.0 Contents Introduction Hardware Compiler overview Program structure Code examples Sample projects For more information,

More information

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B

CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B CPE 325: Embedded Systems Laboratory Laboratory #7 Tutorial MSP430 Timers, Watchdog Timer, Timers A and B Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective This

More information

C Language Programming, Interrupts and Timer Hardware

C Language Programming, Interrupts and Timer Hardware C Language Programming, Interrupts and Timer Hardware In this sequence of three labs, you will learn how to write simple C language programs for the MC9S12 microcontroller, and how to use interrupts and

More information

LCDs. Embedded Systems Interfacing. 20 September 2011

LCDs. Embedded Systems Interfacing. 20 September 2011 20 September 2011 How Polarizers Work How work How Color Work Other Technologies Reflective Nematic (no back light) Cholesteric Liquid Crystal Organic LED/Polymer LED Vacuum Florescent Display Display

More information

Features 2.4 GHz Carrier Frequency RS232 UART interface with variable baud rate Input supply voltage: 5V to 12V 255 possible Channels frequencies (0 to 255) Programmable Device Address (255 per channel)

More information

SquareWear Programming Reference 1.0 Oct 10, 2012

SquareWear Programming Reference 1.0 Oct 10, 2012 Content: 1. Overview 2. Basic Data Types 3. Pin Functions 4. main() and initsquarewear() 5. Digital Input/Output 6. Analog Input/PWM Output 7. Timing, Delay, Reset, and Sleep 8. USB Serial Functions 9.

More information

C Programming Language

C Programming Language C Programming Language Advantages over assembly language for microcontrollers: More portable Math functions Readability Maintainability Editing C End-of-line ignored Use line breaks/tabs/indent for readability

More information

Example of Asyncronous Serial Comms on a PIC16F877

Example of Asyncronous Serial Comms on a PIC16F877 /***************************************************************************************/ /* Example of Asyncronous Serial Comms on a PIC16F877 */ /* Target: PIC16F877 */ /* Baud: 9600 */ /* Bits: 8 */

More information

What happens when an HC12 gets in unmasked interrupt:

What happens when an HC12 gets in unmasked interrupt: What happens when an HC12 gets in unmasked interrupt: 1. Completes current instruction 2. Clears instruction queue 3. Calculates return address 4. Stacks return address and contents of CPU registers 5.

More information

ME 6405 Introduction to Mechatronics

ME 6405 Introduction to Mechatronics ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Microchip PIC Manufacturer Information: Company: Website: http://www.microchip.com Reasons for success: Became the hobbyist's

More information

Simple cpik Tutorial

Simple cpik Tutorial Simple cpik Tutorial by Alain Gibaud alain.gibaud@free.fr Version 0.5.x Rev c January 14, 2010 Contents 1 What you need 1 2 Tutorial #1 - Blinking LED 3 2.1 Header files........................................

More information

University of Hawaii EE 361L MPLab Quick Tutorial and Project 2.1 Last updated September 1, 2011

University of Hawaii EE 361L MPLab Quick Tutorial and Project 2.1 Last updated September 1, 2011 University of Hawaii EE 361L MPLab Quick Tutorial and Project 2.1 Last updated September 1, 2011 This is a quick tutorial of programming the PIC 16F684A processor using the MPLab Integrated Development

More information

A simple data logger for student-designed rocket experiments.

A simple data logger for student-designed rocket experiments. A simple data logger for student-designed rocket experiments. Mechanical Engineering Report 2007/05 P. A. Jacobs Centre for Hypersonics The University of Queensland. March 16, 2007 Abstract The final-year

More information

EE 308 Spring Exam 1 Feb. 27

EE 308 Spring Exam 1 Feb. 27 Exam 1 Feb. 27 You will be able to use all of the Motorola data manuals on the exam. No calculators will be allowed for the exam. Numbers Decimal to Hex (signed and unsigned) Hex to Decimal (signed and

More information

LAMPIRAN. 1. Program Alat

LAMPIRAN. 1. Program Alat LAMPIRAN 1. Program Alat This program was produced by the CodeWizardAVR V2.03.4 Standard Automatic Program Generator Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project

More information

CHAPTER 1 - World of microcontrollers

CHAPTER 1 - World of microcontrollers CHAPTER 1 - World of microcontrollers One Time Programmable ROM (OTP ROM) One time programmable ROM enables you to download a program into it, but, as its name states, one time only. If an error is detected

More information

These 3 registers contain enable, priority,

These 3 registers contain enable, priority, 8.3.2) Registers Related to Interrupts These registers enable/disable the interrupts, set the priority of the interrupts, and record the status of each interrupt source. RCON INTCON, INTCON2, and INTCON3

More information

EE4390 Microprocessors

EE4390 Microprocessors EE4390 Microprocessors Lessons 23, 24 - Exceptions - Resets and Interrupts Revised: Aug 1, 2003 1 - Exceptions - Resets and Interrupts Polling vs. Interrupts Exceptions: Resets and Interrupts 68HC12 Exceptions

More information

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE Fujitsu Microelectronics (Shanghai) Co., Ltd. Application Note MCU-AN-500009-E-10 F²MC-8FX FAMILY 8-BIT MICROCONTROLLER MB95200H/210H SERIES HOW TO USE DBG PIN APPLICATION NOTE Revision History Revision

More information

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform. Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform www.sierraradio.net www.hamstack.com Topics Introduction Hardware options Software development HamStack project

More information

The MC9S12 Timer Input Capture Function

The MC9S12 Timer Input Capture Function The MC9S12 Timer Input Capture Function o Capturing the time of an external event o The MC9S12 Input Capture Function o Registers used to enable the Input Capture Function o Using the MC9S12 Input Capture

More information

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text In this lecture embedded C program for interrupt handling

More information

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE

F²MC-8FX FAMILY MB95200H/210H SERIES HOW TO USE DBG PIN 8-BIT MICROCONTROLLER APPLICATION NOTE Fujitsu Microelectronics (Shanghai) Co., Ltd Application Note MCU-AN-500009-E-10 F²MC-8FX FAMILY 8-BIT MICROCONTROLLER MB95200H/210H SERIES HOW TO USE DBG PIN APPLICATION NOTE Revision History Revision

More information

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & Interrupt Service Routines (ISRs) ECE3411 Fall 2015 Lecture 2c. Interrupts & Interrupt Service Routines (ISRs) Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk,

More information

Embedded Systems. October 2, 2017

Embedded Systems. October 2, 2017 15-348 Embedded Systems October 2, 2017 Announcements Read pages 267 275 The Plan! Timers and Counter Interrupts A little review of timers How do we keep track of seconds using a timer? We have several

More information