M. Smith University of Calgary.  Many people like to sing in the shower.  However, its rather boring as there is no accompaniment.  The McVASH device.

Slides:



Advertisements
Similar presentations
Programmable Interval Timer
Advertisements

Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Microprocessor and Microcontroller
Processor System Architecture
Blackfin BF533 EZ-KIT Control The O in I/O Activating a FLASH memory “output line” Part 2.
Assignment Overview Thermal oscillator One of the ENCM415 Laboratory 2 items Oscillator out GND +5V.
Boot Issues Processor comparison TigerSHARC multi-processor system Blackfin single-core.
Lab. 2 – More details – Tasks 4 to 6 1. What concepts are you expected to understand after the Lab. 2 is finished? 2. How do you demonstrate that you have.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Timers and Timing Signals Tutorial. 6/18/2015 Timer Control Copyright M. Smith, ECE, University of Calgary, Canada 2 / 31 Temperature Sensor -- Lab 3.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
Understanding the Blackfin ADSP-BF5XX Assembly Code Format
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
Getting the O in I/O to work on a typical microcontroller Activating a FLASH memory “output line” Part 1 Main part of Laboratory 1 Also needed for “voice.
GCSE Computing - The CPU
Architecture of the 8051 INTERNAL DATA BUS Oscillator & Timing Programmable I/O (32 Pins) 80C51 CPU 64K byte Expansion Control Serial I/O 4K Program Memory.
Software Development and Software Loading in Embedded Systems.
Inside The CPU. Buses There are 3 Types of Buses There are 3 Types of Buses Address bus Address bus –between CPU and Main Memory –Carries address of where.
Microprocessor or Microcontroller Not just a case of “you say tomarto and I say tomayto” M. Smith, ECE University of Calgary, Canada.
Computer Organization
C.S. Choy95 COMPUTER ORGANIZATION Logic Design Skill to design digital components JAVA Language Skill to program a computer Computer Organization Skill.
Lesson 3 — How a Computer Processes Data
Input Laboratory: GPIO Pin control needed to have the Blackfin accept your commands Re-uses information from ENEL353 and ENCM369 courses and text books.
Lecture#14. Last Lecture Summary Memory Address, size What memory stores OS, Application programs, Data, Instructions Types of Memory Non Volatile and.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 9/19/2015 Review of 50% OF ENCM369 in 50 minutes1.
Blackfin Array Handling Part 2 Moving an array between locations int * MoveASM( int foo[ ], int fee[ ], int N);
M. Smith University of Calgary.  Many people like to sing in the shower.  However, its rather boring as there is no accompaniment.  The McVASH device.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 2.
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
Computer Organization - 1. INPUT PROCESS OUTPUT List different input devices Compare the use of voice recognition as opposed to the entry of data via.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM511.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Assessment Covering… Von Neuman architecture Registers – purpose and use, the fetch execute cycle.
HOW a Computer Works ? Anatomy of Microprocessor.
ALU (Continued) Computer Architecture (Fall 2006).
THE MICROPROCESSOR A microprocessor is a single chip of silicon that performs all of the essential functions of a computer central processor unit (CPU)
IT3002 Computer Architecture
The Central Processing Unit (CPU)
Building a simple loop using Blackfin assembly code If you can handle the while-loop correctly in assembly code on any processor, then most of the other.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 2/26/2016 Review of 50% OF ENCM369 in 50 minutes1.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Assembly Language Review Being able to repeat on the Blackfin the things we were able to do on the MIPS 3/3/2016 Review of 50% OF ENCM369 in 50 minutes1.
A Play Core Timer Interrupts Acted by the Human Microcontroller Ensemble from ENCM415.
Chapter 3. Advanced Hardware Fundamentals The various parts you will commonly find in an embedded-system circuit 발표일시 : 발표자 : 채화영.
IC 3 BASICS, Internet and Computing Core Certification Computing Fundamentals Lesson 2 How Does a Computer Process Data?
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ read/write and clock inputs Sequence of control signal combinations.
GCSE Computing - The CPU
Microprocessor or Microcontroller
UNIT – Microcontroller.
Technology Literacy Hardware.
Introduction of microprocessor
Number Representations and Basic Processor Architecture
A Play Core Timer Interrupts
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Assembly Language Review
A Play Lab. 2 Task 8 Core Timer Interrupts
Assembly Language Review
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
Independent timers build into the processor Basis for Lab. 2
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Independent timers build into the processor
GCSE Computing - The CPU
Blackfin Syntax Stores, Jumps, Calls and Conditional Jumps
Presentation transcript:

M. Smith University of Calgary

 Many people like to sing in the shower.  However, its rather boring as there is no accompaniment.  The McVASH device solves this program. Microprocessor controlled Voice Activated Shower Head  Water propelled electrical turbine for safety  Your voice is DSP analysed and the rhythm detected. ◦ This controls the water level from the shower head. ◦ The beat of the water on the side of the shower walls provides the accompaniment to your singing! 2

 Every thing must be as small as possible to reduce cost. 1 cent / device saving over 1 million devices is a lot of extra profit!  Device control register – is a bit pattern ◦ Bit to “turn on” McVASH device (read and write) ◦ Bit to “turn on” Sound part (read and write) ◦ Sound being recognized bit (microphone working bit) (read only RO) NOTE: Written R Oh not R zero)) ◦ Etc ◦ 16 bit to activate 16 different operations (switches) is enough 3

 Every thing must be as small as possible to reduce cost. 1 cent / device saving over 1 million devices is a lot of profit!  Water temperature – value bit pattern ◦ McVASH device has a TMP03 device (Lab. 2) ◦ Range -- Temperatures between 0C to 70 C ◦ Accuracy – Report temperature to within 0.5C ◦ Typical value are 6 C, 15.5 C ◦ 15.5 C is not an integer value ◦ Floating point processors $400 each – need cheaper approach ◦ Use ideas from ENCM369 on number representation 4

 Water temperature – value bit pattern ◦ Range -- Temperatures between 0C to 70 C ◦ Accuracy – 0.5C is sufficient for a shower ◦ Store 0 C as value 0x00 b ◦ Store 0.5C as value 0x01 b ◦ Store 1 C as value 0x02 b ◦ Store 6 C as value 12 (0x0C) b ◦ Store 6.5 C as value 13 (0x0D) b Store temperature X as value 2X – now all temperatures stored as integer -- $2 processor 5

 Numerical representation ◦ Biggest value 70C = 140 ◦ Smallest value 0C = 0  Choices of how to store this value ◦ Use unsigned byte value :– min 0 to max 255 ◦ Use signed byte value :– min -128 to +127 – NO ◦ Use signed word value :- min to ◦ Cheapest solution that works – unsigned byte value 6

 Need timer to turn off the water ◦ Need to count in seconds  We have a processor that has a clock that runs at 1 MHz ◦ Would need divide logic to turn 1MHz clock into 1 second clock.  Cheaper to have 32 bit register that counts the 1 MHz clock ◦ How many seconds can be counted this way?  Should we use a signed 32 bit register or an unsigned 32 bit register?  Which type of register stores the larger count? 7

 Save more money by having the “turn timer on” timer control bit as one of the bits in existing “Processor control register”.  Need 32 bit counter register TCOUNT  Counts how many “ticks” have ocucrred since time turned on  Need 32 bit “finish” register (TPERIOD).  When the TCOUNT reaches TPERIOD, tell the system to do an interrupt service routine. This ISR turns the water off.  Need 64 bit CYCLES register which counts how long the processor has been turned on ◦ Cheaper to build as “2” 32 bit registers CYCLES and CYCLES2 ◦ Design of McVASH timer very similar to Blackfin CORE TIMER 8

 Each McVASH device has ◦ 3 32-bit timer registers ◦ 8-bit temperature register (temp *2 is stored) ◦ 16-bit control register  Sell on market – two products. Try to minimize total cost ◦ Blackfin controlling 1 McVASH for small summer cottages with only one shower ◦ Blackfin controlling many McVASH for big houses with many showers  How do these ideas fit in with the Microcontroller discussed in Friday’s lecture? 9

10 / 29 CPU contains CCU ALU data registers and pointer registers CONTROL BUS ADDRESS BUS DATA BUS BOOT ROM Used at startup Instruction (program) ROM McVASH Data RAM

11 / 29 CPU contains CCU ALU data registers and pointer registers CONTROL BUS ADDRESS BUS DATA BUS BOOT ROM Used at startup Instruction (program) ROM McVASH Data RAM

◦ Over a period of 5 seconds, keep the temperature of the water at 37C ◦ PSEUDO CODE For ever Record temperature values at regular intervals For the last 5 seconds, work out temperature if below 37C add less cold water, more hot if above 37C add more cold water, less cold end 12

#define TEMPERATURE37C 74 // PROTOTYPES OF FUNCTIONS TO BE DEVELOPED void WaitTenthSecond( void); unsigned ReadTemperatureASM( void); unsigned int AverageTemperature(unsigned int *temperature); OR unsigned int AverageTemperature(unsigned int temperature[ ] ); SAME CODE NEEDED other prototypes as needed void ControlWaterTemperature(void) { unsigned int temperature[50]; for (count = 0 to 50) { WaitTenthSecond( ); temperature[count] = ReadTemperatureASM( );  The code to be developed this lecture } unsigned int averageTemperature = AverageTemp(temperature); THIS FUNCTION CAN’T POSSIBLY BE USED TO CALCULATE AVERAGE TEMPERATURE FROM AN ARRAY OF TEMPERATURES – WHY NOT? if (averageTemperature != TEMPERATURE37C ) AdjustWaterTemperature(averageTemperature); }; 13

 temperature[count] = writes to a memory array – stored on the processor stack – SDRAM ◦ The processor is started up with a stack already placed in memory ◦ Easy to access this sort of array using “Standard C”  ReadTemperature – reads from a memory array of registers that belong to the McVASH device ◦ Where is this peripheral device register array? ◦ Must know location of the peripheral device register array in order to be able to read and write values to it! ◦ There might be more than one memory array (one for each McVASH) 14

15 / 29 External Device Device itself with all necessary internal logic to do the things it needs to do DATA BUS OE Output Enable other signals such as interrupt signals, etc ADDRESS BUS DECODE LOGIC Address strobe Data strobe Read/Write control CS – chip select

McVASH 1 – control logic build to recognize addresses on the processor address bus in the range 0x to 0x20001F. ◦ Why not the range 0x to 0x2FFFFF? ◦ Why not the range 0x to 0x50001F?  McVASH 2 – control logic build to have the device register memory array start at address 0x  McVASH 3 – control logic build to have the device register memory array start at address 0x

 Each McVASH device decode logic permit ◦ 3 32-bit timer registers Address are 0x200000, 0x200004, 0x ◦ 8-bit temperature register (temp *2 is stored) Address is 0x20000C ◦ 16-bit control register Address is ?????? Next location available is 0x20000D (address is not even – look at bit 0 ) but processors can not access 16-bit peripheral registers (or memory locations) whose address is “odd” (unless you want to pay more for the processor) Control register therefore designed to have address 0x20000E (address is even – look at bit 0 ) 17

 Each McVASH device has ◦ 3 32-bit timer registers Address are 0x300000, 0x300004, 0x ◦ 8-bit temperature register (temp *2 is stored) Address is 0x30000C ◦ 16-bit control register Next location available is 0x30000D (address is not even) but processors can not access 16-bit registers whose address is “odd” (unless you want to pay more for the processor) control register therefore designed to have address 0x30000E 18

…. Other code.section L1_data;.byte4 _fooArray[2];.section program;.global _AddArrayValuesASM; _AddArrayValuesASM: #define sum_R0 R0// register int sum; sum_R0 = 0; // sum = 0; #define pointer_to_array_P1 P1// register int * pointer_to_array P1.L = lo(_fooArray); P1.H = hi(_fooArray); // pointer_to_array = &fooArray[0]; R1 = [pointer_to_array_P1]; // int temp = fooArray[0]; sum_R0 = sum_R0 + R1; // sum = sum + temp R1 = [pointer_to_array_P1 + 4]; // temp = fooArray[1]; sum_R0 = sum_R0 + R1; // sum = sum + temp _AddArrayValuesASM.END: RTS; 19 / 28

.section program;.global _ ReadTemperatureASM; _ ReadTemperatureASM; : #define temperature_R0 R0 #define pointerMcVASHDevice_P1 P1 #define ADDRESS_McVASH_DEVICE 0x20000 P1.L = lo(ADDRESS_McVASH_DEVICE); P1.H = hi(ADDRESS_McVASH_DEVICE); // Need to read 8-bit temperature value – B for Byte – zero-extend to 32- bits temperature_R0 = B[pointerMcVASHDevice_P1 + 0xC] (Z); _ ReadTemperatureASM;.END: RTS; 20 / 28

.section program;.global _ReadTemperatureDevice2ASM; _ReadTemperatureDevice2ASM: #define temperature_R0 R0 #define pointerMcVASHDevice_P1 P1 #define ADDRESS_McVASH_DEVICE2 0x30000 P1.L = lo(ADDRESS_McVASH_DEVICE2); P1.H = hi(ADDRESS_McVASH_DEVICE2); // Need to read 8-bit temperature value – B for Byte – zero-extend to 32- bits temperature_R0 = B[pointerMcVASHDevice_P1 + 0xC] (Z); _ReadTemperatureDevice2ASM.END: RTS; 21 / 28

22

unsigned int ReadTemperatureDeviceCPP(void) { unsigned char temperatureValue; (byte) Somehow read a byte value from a specific register from a device located some where on the external address bus of the microcontroller return (unsigned int) temperatureValue; } That “somehow” is difficult to do with most “C/C++” compilers – which is why most interfaces to hardware are done in assembly code 23

#define ADDRESS_McVASH_DEVICE 0x20000 unsigned int ReadTemperatureDeviceCPP(void) { unsigned char temperatureValue; // “byte” in “C” is unsigned char // Use the key word “volatile” to tell embedded C” that this is an external device location unsigned char *pointerToDeviceRegister = (volatile unsigned char *) ADDRESS_McVASH_DEVICE; // Point to device temperature register pointerToDeviceRegister = pointerToDeviceRegister + 0xC; // get the temperature value using a “pointer to a peripheral device register location” temperatureValue = *pointerToDeviceRegister return (unsigned int) temperatureValue; } 24

25

1. Use “print screen” to do a “VDSP screen capture” and then paste into a “.doc” file 2. After you have developed “C” code and linked it (without error)s, then “right click” on the source code window and select “MIXED” ◦ You can now see the assembly language code that the “C” compiler generated 3. You can cut and paste “example code” from the Powerpoint slides into VDSP is you know this trick 4. Starting point for my “Tests” on the McVASH device 26

27

 Code has extra “strange characters” -- remove them 28