Page 1 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training CAPCOM6.

Slides:



Advertisements
Similar presentations
Review: Interrupts & Timers
Advertisements

Lab7: Introduction to Arduino
Mini-SumoBot Construction and Programming
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
Microcontroller Programming II MP6-1
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
By: Russ Butler ECE4220 Spring 2012 Dr. DeSouza May 2, 2012.
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
Drives & Control June 2003 A. Jansen 1 Brushless DC Motor Control with C868 and CAPCOM6.
1 Homework Reading –Review previous material on “interrupts” Machine Projects –MP4 Due today –Starting on MP5 (Due at start of Class 28) Labs –Continue.
Infineon Technologies Corp. June 99 1 HOT167-1 Version 2.0 * C167CS not yet supported by DAvE V1.0 CD ROM. See “Hints regarding DAvE.” Exercise 7ASC_1.
Infineon Technologies Corp. June 99 1 HOT167-1 Version 2.0 F PWMmax = x 50ns = 78 kHz Pulse Width Modulation Unit (PWM) (20 MHz)  4 independent.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
IDE for ARM 7 board Tutorial 3 IDE of Keil4 V3.a 1.
Using PDG with e2studio: Example
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
ECE Department: University of Massachusetts, Amherst Lab 1: Introduction to NIOS II Hardware Development.
The 8051 Microcontroller and Embedded Systems
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
BLDC MOTOR SPEED CONTROL USING EMBEDDED PROCESSOR
NS Training Hardware. System Controller Module.
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
Silicon Labs ToolStick Development Platform
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
Renesas Electronics Europe GmbH A © 2010 Renesas Electronics Corporation. All rights reserved. RL78 Clock Generator.
System Clocks.
EE 446 Project Assignment Top Design Sensor Components Pin Assignment and Configuration Completed Physical Setup Project Tasks.
PS - 87C51Mx2 - SLS-1 Philips Semiconductors 87C51Mx2 Microcontroller.
Introduction to PIC-C. Required Software PIC-C Compiler Firmware Downloader Driver for the USB->Serial Adapter.
Lecture Set 9 MCS-51 Serial Port.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Industrial Reference Design Platform RS-232 Interface Developed by the TSC Americas Release 1.0.
1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used.
1 Lab 5: Controls and feedback. 2 Lab 5: Control and Feedback This embedded system uses the Photo sensor to detect the light intensity of the environment.
LAB 8: Program Design Pattern and Software Architecture
1 LHO 13 The 8051CF020 and the University Daughter Card.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
Example. SBUF Register SCON Register(1) SCON Register(2)
Siemens Microelectronics, Inc. December 98 Slide 1 HOT50x-5 Version 1.0 HOT50x-5 An Add-On to the HOT50x_1 Hands-On Training Materials for the 8bit Family.
8051 Micro controller. Architecture of 8051 Features of 8051.
Development of a microprocessor project with LPC2388 development board.
The HVM embedded Java VM For very tiny devices. Overview Hardware near programming: a case example Hardware near programming: a case example in Java Contributions.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Introduction to PIC-C. Installing PIC-C Goto Username/pass = guest/cpecmu Download and install:  IDEUTIL  PCWHD.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 4 Standard Single Purpose Processors: Peripherals.
ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts.
Serial Communications Interface Module Slide #1 of 19 MC68HC908GP20 Training PURPOSE -To explain how to configure and use the Serial Communications Interface.
Chapter 5 - Interrupts.
LHO 22 C and the  The Silicon Labs ISE uses the Keil C51 compiler.  The code size is limiter to 2K  C has replaced PL/M (the original Intel high.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
Using Linux with ARM Tutorial #3.
Chapter 3. Advanced Hardware Fundamentals The various parts you will commonly find in an embedded-system circuit 발표일시 : 발표자 : 채화영.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
Page 1 D&C EBV Seminar June 2003 Software Instaaltion Chevillot June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training Software Installation.
ENERGY METER TO INDICATE BILLING IN RUPEES FOR LOAD WISE OR DAY WISE
Homework Reading Machine Projects
The first change to your project files that is needed is to change the device to the correct FPGA. This is done by going to the Assignments tab on the.
PROPELLER DISPLAY OF MESSAGE BY VIRTUAL LEDS
Overview Basic PIC Circuits Development in C using CCS
SERIAL PORT PROGRAMMING
Homework Reading Machine Projects Labs
ECE 3567 Microcontroller Lab
Microcontroller Labs Lab 1 – The LED Test Mode Dr. Gregg Chapman
8051 Micro Controller.
Software Setup & Validation
Prof. Chung-Ta King Department of Computer Science
Source: Serial Port Source:
ECE 3567 Microcontrollers Lab
Presentation transcript:

Page 1 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen June 2003 N e v e r s t o p t h i n k i n g. Infineon C868 Hands On Training CAPCOM6 Basics

Page 2 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Contents Aim: Aim: working BLDC motor control application (Hall Mode) 3 Steps 1 st Step: Port Pin control –byte sent through RS232  output on the Port 3 (LEDs) 2 nd Step: CAPCOM6 Modulation test –byte sent through RS232  MCMOUT register 3 rd Step: Hall Sensor mode simulation –byte sent through RS232  CCPOS (Hall sensors) You are now 40 clicks away from BLDC Motor Control

Page 3 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins The aim of this exercise is to be able to control the Port 3 through the serial link You will: –Configure the serial link : serial port and timer 2 –Configure the Port pins

Page 4 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins Create a directory named „HOT“ and inside another named „Step1“ System Configuration: Launch Dave and create a new project with „C868_r2“ device Set Oscillator speed to 10MHz with a prescaler of 15/4 Choose „Small“ Memory Model 1 2

Page 5 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins Peripheral Configuration: Disable Watchdog Timer and enable FSM_vInit function Set Port 3 as output and enable IO_vInit function

Page 6 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins Serial link Configuration: Configure the UART: –Use TxD pin –Enable Receiver –Enable Interrupt –Double Baud Rate (for Timer 2) –Enable UART_vInit function Configure Timer 2 for Baudrate generation –Enable Transmit and Receive Clock –Set Baudrate value to 0xFF86 (9600 Bauds) –Enable T2_vInit function

Page 7 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins You can save your project to the “Step 1” directory –use the name “hot” Push The “Generate” button inside Dave –Dave will generate all the files needed for the project Double click on Dave project “Hot.dpt” –this will open Keil  Vision Configure Project Options  Target: –Set Small Memory model –Set Compact Code Rom Size –Use On-Chip ROM/RAM

Page 8 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins Configure Project Options  Output : –Enable Create HEX File Configure Project Options  Utilities : –Use External Flash Programming Tool –Browse for Command Line Tool –Set Arguments to: (change it for your com port) BR9600 –COM1 “#H” 18 19

Page 9 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins Add an infinite loop in the Main routine (main.c) : Add Serial Link state machine (uart.c) : This is a simple state machine which waits for two bytes. First byte is called “Command” Second byte is associated data For Step1 we need 1 command: 0x00  Copy data to Port3 void main(void) { // USER CODE BEGIN (MAIN_Main,2) // USER CODE END MAIN_vInit(); // USER CODE BEGIN (MAIN_Main,3) while (1) { } // USER CODE END } // End of function main if (RI) { // USER CODE BEGIN (UART_Isr,3) static ubyte stage = 0; static ubyte command; ubyte value; switch (stage) { case 0: command = SBUF; stage = 1; break; case 1: value = SBUF; switch (command) { case 0x00: // set P3 P3 = value; break; } stage = 0; break; default: break; } // USER CODE END RI = 0; } NOTE: you can copy paste this into Keil

Page 10 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 1: Timer, UART and Port pins You can now compile your program  F7 or button Unplug and re-plug the power supply from your board Push the Load Button Launch Docklight and add some commands: –note that you hace to configure Docklight to use the proper com port You can now play with the LEDs ! HINT : When you have finished with Docklight, push the STOP button !! Compile Load Options

Page 11 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation The aim of this exercise is to be to control the LEDs using the CAPCOM modulation capabilities You will: –Configure the CAPCOM6: Timer 13 Multi-Channel Mode

Page 12 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation Create a directory named „Step2“ and copy all the files from Step1 Launch Dave by clicking on „Hot.dav“ file Port Configuration Disable PORT3 as CAPCOM will use it –you can also remove the IO_vInit function CAPCOM6 Configuration Use CC6x and COUT6x as outputs Enable Timer T13 Select fcpu/128 (we want to be able to see the LEDs blinking) Set T13 Period to maximum (0xFFFF)

Page 13 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation CAPCOM6 Configuration (cont.) Enable Multi-Channel Mode For EACH Channel (0,1 and 2) : –Set Compare Mode 3 –Enable T13 Modulation for CC6x (Low Side) –Enable PWM generation by T12 or T13 for CC6x and COUT6x –Set Passive state to ‘1‘ for CC6x and COUT6x (Low Active Bridge) For Channel 3, Set Duty-Cycle to 50% Enable CC6_vInit function Enable CC6_vEnableShadowTransfer function Enable CC6_vLoadChannelShadowRegister

Page 14 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation You can save your project to the “Step 2” directory Push The “Generate” button inside Dave Double click on Dave project “Hot.dpt” this will open Keil  Vision Modify UART function for new command: For Step2 we need 2 commands: 0x00  Modify Duty-Cycle 0x01  Modify MCMOUT register (modulation) case 1: value = SBUF; switch (command) { case 0x00: // set duty cycle CC6_vLoadChannelShadowRegister(CC6_CHANNEL_3,(unsigned short)value<<8); CC6_vEnableShadowTransfer(CC6_TIMER_13); break; case 0x01: // set MCMOUTSL : PWM Pattern MCMOUTSL = value; MCMOUTSL |= 0x80;// Shadow transfer request to initiate things break; } stage = 0; break;

Page 15 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation Compile the program (F7) Push The “Generate” button inside Dave Unplug and re-plug the power supply from your board Push the Load Button Launch Docklight and add some commands You can now play with Step2 –Try different combinations for MCMOUT

Page 16 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 3: Hall Sensor Mode (simulated) This exercise is the same as Step3. We will simulate the Hall Sensors via the serial link. The PWM patterns will change accordingly. You will: –Configure the CAPCOM6: Hall Sensor Mode –Setup a State Machine for the PWM patterns

Page 17 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 3: Hall Sensor Mode (simulated) Create a directory named „Step3“ and copy all the files from Step2 Launch Dave by clicking on „Hot.dav“ file CAPCOM6 Configuration Use CC6x and CCPOSx as inputs Enable Internal Simulation Enable Hall Sensor Mode –answer yes to the question box Set Transfer on Correct Hall Event Enable Correct/Wrong Hall Event Interrupt In Trap/Interrupt Control  Interrupt Configuration: –Enable Node

Page 18 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation You can save your project to the “Step 3” directory Push The “Generate” button inside Dave Double click on Dave project “Hot.dpt” this will open Keil  Vision Add State Machine variables and initialization in CC6.c // USER CODE BEGIN (CCU6_General,1) unsigned char code HallPatterns[6]= { 0x25,// Current=100 Expected=101 0x29,// Current=101 Expected=001 0x0b,// Current=001 Expected=011 0x1a,// Current=011 Expected=010 0x16,// Current=010 Expected=110 0x34// Current=110 Expected=100 }; unsigned char code PWMPatterns[6]= { 0x24,// U=0 V=- W=+ COUT62/CC62=10 COUT61/CC61=01 COUT60/CC60=00 0x06,// U=+ V=- W=0 COUT62/CC62=00 COUT61/CC61=01 COUT60/CC60=10 0x12,// U=+ V=0 W=- COUT62/CC62=01 COUT61/CC61=00 COUT60/CC60=10 0x18,// U=0 V=+ W=- COUT62/CC62=01 COUT61/CC61=10 COUT60/CC60=00 0x09,// U=- V=+ W=0 COUT62/CC62=00 COUT61/CC61=10 COUT60/CC60=01 0x21// U=- V=0 W=+ COUT62/CC62=10 COUT61/CC61=00 COUT60/CC60=01 }; unsigned char CurrentState; // USER CODE END // USER CODE BEGIN (Init,3) CurrentState = 0; MCMOUTSL = PWMPatterns[5];// load the shadow registers with according patterns MCMOUTSH = HallPatterns[5]; MCMOUTSL |= 0x80;// Shadow transfer request to initiate things MCMOUTSH |= 0x80; MCMOUTSL = PWMPatterns[0];// load the shadow registers with according patterns MCMOUTSH = HallPatterns[0]; // USER CODE END } // End of function CC6_vInit

Page 19 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation Add the State Machine Handling in the CC6 interrupt handler : –This State Machine reloads the MCMOUT shadow register with the next value void CC6_viNodeI0(void) interrupt CCU6_NodeI0_INT { // USER CODE BEGIN (NodeI0,2) // USER CODE END IRCON1 &= ~(ubyte)0x04; // clear INP0 if(ISH & 0x20) //if ISH_WHE { //wrong hall event detection // USER CODE BEGIN (NodeI0,18) SBUF = 0xff; // send an error // USER CODE END ISRH = 0x20; //clear flag ISH_WHE } if(ISH & 0x10) //if ISH_CHE { //correct hall event detection // USER CODE BEGIN (NodeI0,16) CurrentState ++; if (CurrentState>=6) CurrentState = 0; // load the shadow registers with according patterns MCMOUTSL = PWMPatterns[CurrentState]; MCMOUTSH = HallPatterns[CurrentState]; SBUF = CurrentState; // send an acknowledge // USER CODE END ISRH = 0x10; //clear flag ISH_CHE } } // End of function CC6_viNodeI0

Page 20 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 2: CAPCOM6 Modulation Modify UART function for new command: For Step3 we need commands: 0x00  Modify Duty-Cycle 0x01  Modify PISEL register (Hall Sensor Simulation) case 1: value = SBUF; switch (command) { case 0x00: // set duty cycle CC6_vLoadChannelShadowRegister(CC6_CHANNEL_3,(unsigned short)value<<8); CC6_vEnableShadowTransfer(CC6_TIMER_13); break; case 0x01: // set P1: CCPOS... P1 = value; break; } stage = 0; break;

Page 21 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 3: Hall Sensor Mode (simulated) Compile the program (F7) Push The “Generate” button inside Dave Unplug and re-plug the power supply from your board Push the Load Button Launch Docklight and add some commands You can now play with Step3 –Try different combinations for PISEL

Page 22 D&C EBV Seminar June 2003 Motor Demo C868 Chevillot/Jansen Step 3: Hall Sensor Mode (simulated) All the patterns are extracted from a real motor pattern: 0x80 0xA0 0x20 0x60 0x40 0xC0 Pisel value :