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

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

Team 8: Robert Blake Craig Goliber Alanna Ocampo

Speed Control of a DC Motor using Digital Control

Lecture (04) PIC 16F84A programming I

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

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

LCD. Configuration and Programming

More Fun with Timer Interrupts

Timer1 Capture Mode:

Analog Output with a Digital to Analog Converter

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

Flow Charts and Assembler Programs

Lecture (03) PIC16F84 (2)

Microcontroller Overview

ECE Homework #10

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

8051 Microcontroller Interrupts

Interrupts on PIC18F252 Part 2

Human Response Timer

Interrupts. Embedded Systems Interfacing. 08 September 2011

Laboratory 10. Programming a PIC Microcontroller - Part II

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

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

Accurate Time and Interrupts

Chapter 11: Interrupt On Change

Embedded System Design

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

EE 361L Digital Systems and Computer Design Laboratory

Binary Outputs and Timing

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

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

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

The University of Texas at Arlington Lecture 21_Review

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

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

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

DESIGN AND IMPLEMENTATION OF A SPECTATOR COUNTING SYSTEM

Model Answer Microcontrollers. MCQ Problems Total Q1 Q2

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

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

Table of Contents COMPANY PROFILE 1-1 SECTION 1. INTRODUCTION 1-1

Final Design Report. Team Name: No Rest for the Weary

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

CN310 Microprocessor Systems Design

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING. BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017

Input/Output Ports and Interfacing

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL

Simon. Final Project Report December 11, 2009 E155. Julia Karl and Kirsten McAfee

MICROPROCESSORS A (17.383) Fall Lecture Outline

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

UNCA CSCI 255 Exam 3 Fall 2011

NOTICE: 1, the timing for Start, Stop, ACK, NACK, write and read is same as I2C

Experiment 9: Using HI-TECH C Compiler in MPLAB

Capture Mode of Pic18F252

Architecture of Computers and Parallel Systems Part 6: Microcomputers

evsjv `k cigvyy kw³ Kwgkb BANGLADESH ATOMIC ENERGY COMMISSION

MICROPROCESSORS A (17.383) Fall Lecture Outline

CREATING FIRST PROJECT in mikropascal PRO for PIC32

ELCT 912: Advanced Embedded Systems

Introduction to PIC Programming

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS

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

EXPERIMENT 4: Parallel Input/Output. Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

Microprocessors B (17.384) Spring Lecture Outline

Interrupts, timers and counters

ELCT708 MicroLab Session #1 Introduction to Embedded Systems and Microcontrollers. Eng. Salma Hesham

Reprinted by permission of T&L Publications Inc. Copyright 2001 USB MICROCONTROLLERS FOR THE MASSES

Introduction to PIC Programming

Contents. PIC Mini Data Sheets

PIC Discussion By Eng. Tamar Jomaa

Unit B - Rotary Encoders B.1

These 3 registers contain enable, priority,

HC12 Built-In Hardware

The University of Texas at Arlington Lecture 5

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

ME 6405 Introduction to Mechatronics

Magic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours

Getting acquainted with the development tools June 27, 2006 ELE492 Embedded System Design Exercise 1

Chapter 13. PIC Family Microcontroller

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

Embedded Systems Programming and Architectures

ATMega128 Rapid Robot Controller Board [RKI-1148]

Microcomputers. C and Embedded Systems

Laboratory: Introduction to Mechatronics

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

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING B.ENG (HONS) ELECTRICAL AND ELECTRONIC ENGINEERING EXAMINATION SEMESTER /2016

CENG-336 Introduction to Embedded Systems Development. Timers

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design

Inverted Pendulum Microprocessor and FPGA Manual Sheldon Logan July 3, 2006

ECE Homework #3

Appendix A: Rack Specification Sheet

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table

MAKING PIC MICROCONTROLLER INSTRUMENTS AND CONTROLLERS

Transcription:

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 generation and control system of the bike. Through e-mail with electrical component suppliers and TA s James and Eric Shane received a better knowledge base of how to control the voltage and limit the current to the components. Using resistors, voltage regulators, and fuses the electrical map has been safety designed and gives a visual of the overall project. The diagram of the electrical map below was created using Microsoft Visio. A brief summary of the system is the generator, due to gear ratios currently in place, spins 24X faster than the pedals the user is forcing around. Using an estimate of 50 RPM for the user thus causes the generator to rotate at 1080 RPM. Using the manual from the generator 1080 RPM generates ~6 Volts. Because the system has a 12V battery more voltage is required. The team needs to either redesign the gear system or to add a transformer. The values of the voltage regulators were also determined going to eat unit as well as the fuses. It was also decided that because the Philips LCD DVD player is only charged using AC unless using a car cigarette outlet adapter, the adapter needs to be purchased. Majority of Shane s portion

BME 4900 Page 2 of 2 of the final report was also written over the Thanksgiving break. This was so when he came back on Saturday he spent a lot of time in the SD lab working on the electrical system. By the end of Tuesday, with a lot of help from Eric, Shane was able to complete the 400 m mini-track multisim. Also with the help of Eric, Shane was able to produce a C code for the microcontroller used in the 400 m mini-track. The multisim file can be found below. However when the file was attempted to be converted to ultiboard, nearly all of the components were considered virtual and were not transferred. This is an issue that will be addressed in the very near future. The C code produced can be found at the end of this report. Future work for Shane includes fixing the ultiboard issue as well as actually determining the correct parts needed to build the electrical system and ordering them. Other parts that are a priority to order are the stock steel for reinforcing the frame. Basically the teams goal is to have all parts ordered by the beginning of break. Some of these parts include all the electrical components mentioned before, the wheel attachment for the generator, LEDs, stock steel, wires and fasteners, voltage regulators, fuses, crystal oscillator, and the PIC 18F877 microcontroller. Continuous updating of the budget, timeline, and parts is an always ongoing process.

BME 4900 Page 3 of 2 C CODE: #include <stdlib.h> //standard include files #include <pic.h> #include <htc.h> CONFIG(DUNPROT & PWRTDIS & XT & WDTDIS & BORDIS & LVPDIS); #ifndef _XTAL_FREQ // Unless already defined assume 4MHz system frequency // Used to calibrate delay_us() and delay_ms() #define _XTAL_FREQ 7372800 #endif #define pulse RB0 //Sets ENTER_BUTTON to the value of pin RB0 int ChangeState, counter; //;;;;;;; LoopTime subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; //; //; This subroutine waits for Timer2 to complete its ten millisecond count //; sequence. void LoopTime(void) for (;;) if ( TMR2IF ) // Check whether ten milliseconds are up TMR2IF=0; // Clear flag //;;;;;;; Initial subroutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; //; //; This subroutine performs all initializations of variables and registers. //; It is important to refer to the PIC datasheet to understand what is happening. void Initial(void) TRISA = 0b00001011; matter TRISB = 0b00000001; and RB1, RB2, TRISC = 0b00000000; TRISD = 0b00000000; TRISE = 0b00000100; matter PR2 = 95; PORTD = 0; // Set I/O for PORTA - doesnt // Set I/O for PORTB - RB0 must be input //RN4, RB5 must be output // Set I/O for PORTC - all output // Set I/O for PORTD - all output // Set I/O for PORTE - doesnt // Set up Timer2 for a looptime of 10 ms // Turn off LEDs

BME 4900 Page 4 of 2 PORTC = 0; T2CON = 0b01011111; // Finish set up of Timer2 counter = 0; // set count to 0 ChangeState = 0; // set inital flag to 0 OPTION = 0b00000100;// Timer 0 prescale set 32:1 INTCON = 0b10000000; // Enable interrupts //;;;;;;; Mainline program ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; void distance_finder() //finds distance by counting if(!pulse) ChangeState = 1; sensor magnet is still on sensor if(changestate == 1) ChangeState = 0; revolution (magnet pass) //ChangeState remembers if magnet is on //Returns to program if //Resets the ChangeState for next if(counter == 1114) //NOTE magnet has radius 57.15 mm, thus circumference is //.359084 meters. 400/..359084 = 1,114 revolutions //If the final state, max xount, is currently in use the counter //is reset to 0 counter = 0; else counter = counter++; // increment count by 1

BME 4900 Page 5 of 2 void LightLED() //This function lights the LEDs depending on what //the value of the count is. if(counter<53) //It checks the value against a series of IF statements //chooses the appropriate level and sets the correct PORTD = 0b00000000; //number of pins high, turning them on // NOTE 1114/21 = 53 counts per LED // 21 options for LEd because all off is an option as // turning each one on one by one else if(counter<53*2) PORTD = 0b00000001; else if(counter<53*3) PORTD = 0b00000011; else if(counter<53*4) PORTD = 0b00000111;

BME 4900 Page 6 of 2 else if(counter<53*5) PORTD = 0b00001111; else if(counter<53*6) PORTD = 0b00011111; else if(counter<53*7) PORTD = 0b00111111; else if (counter<53*8) PORTD = 0b01111111; else if (counter <53*9) else if (counter <53*10) PORTC = 0b00000001; else if (counter <53*11) PORTC = 0b00000011;

BME 4900 Page 7 of 2 else if (counter <53*12) PORTC = 0b00000111; else if (counter <53*13) PORTC = 0b00001111; else if (counter <53*14) PORTC = 0b00011111; else if (counter <53*15) PORTC = 0b00111111; else if (counter <53*16) PORTC = 0b01111111; else if (counter <53*17) PORTC = 0b11111111; else if (counter <53*18) PORTC = 0b11111111; RB1=1; else if (counter <53*19)

BME 4900 Page 8 of 2 PORTC = 0b11111111; RB1=1; RB2=1; else if (counter <53*20) PORTC = 0b11111111; RB1=1; RB2=1; RB4=1; int main(void) //This is the main body of the program //All functions of the program start here and are called //either by the endless FOR loop or a subsidiary. Initial(); //This function initializes necessary registers for(;;) distance_finder(); LightLED();