MCO556 Practice Test 2

Size: px
Start display at page:

Download "MCO556 Practice Test 2"

Transcription

1 Question 1 : MCO556 For the program shell on the following page, fill in the blanks and add the code required to create a program which flashes LEDs. The LED flashing must be controlled from the keypad and a PC running Hyperterminal connected to the SCI. The hardware configuration is identical to the EVB board in lab A4070. The flash rate of LED2 must be approximately 1 Hz and is controlled by Timer Overflow interrupts. The flash rate of LED5 must be 0.5 Hz and is controlled by Timer Channel 1 operating in output compare mode. Timer configuration Prescale factor for clock to divide by 8 (required by keypad driver) Use Output Compare channel 1 (channel numbers start at 0) 50 Hz output square wave on Port T.1 Serial communications configuration: Use SCI bps 8 data bits no parity 1 stop bit receive interrupts enabled LED operation The Timer Overflow interrupt will be used to create a time delay allowing the LED2 of PORTB to flash with a frequency of approximately 1 Hz (50% duty cycle). Flashing will be enabled or disabled from the keypad as described below: The Output Compare interrupt will be used to create a time delay allowing the LED5 of PORTB to flash with a frequency of 0.5 Hz (50% duty cycle). Flashing will be enabled or disabled from the Hyperterminal as described below: Start up operation On start up, LED 0, 5, and 7 must be ON and all other LEDs must be OFF. LED2 Control When a 0 is pressed on the keypad, PORTB LED2 will turn off. The remaining LEDs must not be modified. When a 1 is pressed on the keypad, PORTB LED2 will flash with a frequency of 1 Hz (50% duty cycle). The remaining LEDs must not be modified. When a 2 is pressed on the keypad, PORTB LED2 will turn on. The remaining LEDs must not be modified. LED5 Control When a 0 is pressed on the PC keyboard, PORTB LED5 will turn off. The remaining LEDs must not be modified. When a 1 is pressed on the PC keyboard, PORTB LED5 will flash with a frequency of 0.5 Hz (50% duty cycle). The remaining LEDs must not be modified. When a 2 is pressed on the PC keyboard, PORTB LED5 will turn on. The remaining LEDs must not be modified. Notes 1) Only the depression of the 0, 1 and 2 keys on the keypad and the PC keyboard must affect the operation of LED2 and LED5. All other inputs from the keypad and PC keyboard must have no effect on the operation of the program. 2) You will need separate task counters for the Output Compare and Timer Overflow interrupts. 3) Use volatile global variables to communicate between interrupts and main. 4) LEDs are numbered 0-7 with LED0 as the right-most. 5) Assume the keypad driver files have been added to the project. Remember the driver uses Timer channel 7 interupts. G VandeBelt

2 #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> // register descriptions #include keypad.h #define PERIOD // time between output compare interrupts // with prescale = 8 void TOC1open(void); /* sets up timer 1 for output compare */ void SCIopen(void); /* sets up SCI */ // global variables as required #pragma CODE_SEG NEAR_SEG NON_BANKED /* interrupt function will cause LED5 to flash at 0.5 Hz rate */ interrupt void TOC1_isr(void) G VandeBelt

3 /* interrupt function will cause LED2 to flash at approximately 1 Hz rate */ interrupt void TOF_isr(void) /* SCI receive interrupt to control LED5 */ interrupt void SCIrx_isr(void) #pragma CODE_SEG DEFAULT G VandeBelt

4 G VandeBelt MCO556 void main(void) // local variables as required DDRB = ; TSCR1 = ; TSCR2 = ; // data direction register PORT B as output // enable timer // set prescale for divide by 8 with interrupt // more initialization while(1) // do forever loop

5 /* initialize Timer Channel 1 for Output Compare interrupt */ void TOC1open(void) TIOS = ; TCTL1 = ; TCTL2 = ; TIE = ; TFLG1 = ; TC1 = ; // sets counts to current + required delay/ /* initialize SCI for 2400 bps 8 bit, no parity, 1 stop bit and receive interrupts */ void SCIopen(void) SCI0BRL = ; SCI0BRH = ; SCI0CR2 = ; G VandeBelt

6 Question 2: MCO556 For the program in question 1, fill in the blanks for the linker file shell shown below. NAMES END SECTIONS MY_RAM = READ_WRITE 0x1000 TO 0x2FFF; MY_PSEUDO_ROM = READ_ONLY 0x3000 TO 0x3FFF; END PLACEMENT _PRESTART, STARTUP, ROM_VAR, STRINGS, NON_BANKED,DEFAULT_ROM, COPY INTO MY_PSEUDO_ROM; DEFAULT_RAM INTO MY_RAM; END STACKSIZE 0x100 // data RAM // code RAM VECTOR ADDRESS VECTOR ADDRESS VECTOR ADDRESS VECTOR ADDRESS KPisr VECTOR ADDRESS Startup // Timer Overflow vector // Timer channel 1 vector // SCI 0 vector // keypad vector // reset vector G VandeBelt

7 Question 3 : MCO556 For the program shell on the following page, fill in the blanks and add the code required to create a program which converts an analog voltage on a selected ADC channel to an 8 bit digital value. Keyboard commands from a PC running Hyperterminal specified the ADC channel. The results of the conversion are displayed on the PC screen. Also messages are displayed on the LCD module. The hardware configuration is identical to the EVB board in lab A4070. Serial communications configuration: Use SCI bps 8 data bits no parity 1 stop bit receive interrupts enabled A to D converter configuration: Use one of ADC channels 0, 1, 2 and 3 with 4 samples per conversion cycle 10 bit resolution, unsigned result, left justified Single conversion cycle minimum sample time maximum frequency clock On start up, the LCD module must be blank. ADC operation When a 0, 1, 2 or 3 is sent from Hyperterminal to the micro, a conversion for ADC channel 0, 1, 2 or 3 will be started. Also, the message Channel n must be displayed on the first line of the LCD module where n is the channel requested. The rest of the display must be blank. When the ADC conversion sequence is complete, the four conversions for the cycle must be average, converted to ASCII and sent to the PC for display on the screen. All other keyboard characters must be ignored by the program. Notes: 1) The ADC conversion function must be called from main. 2) Every message displayed on the PC screen must be on a separate line. The message must be sent only once when a key is pressed. The messages must be sent in main. 3) Assume the LCD driver files have been added to the project. Remember the LCD uses Timer channel 6 interrupts. Hints: Use the _itoa library function to convert the 8 bit value into an ASCII string. Calling procedure _itoa(value, buffer, 10); // where buffer contains storage for the string The ASCII code for carriage return is 0x0D and the code for line feed is 0x0A G VandeBelt

8 Question 3 : Answer MCO556 #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> // register descriptions #include <stdlib.h> #include lcd.h void SCIopen(void); void SCIputch(unsigned char Data); void SCIputs(unsigned char Str[]); void ADCopen(void); unsigned char ADCgetSample(unsigned char chan); // global variables as required #pragma CODE_SEG NEAR_SEG NON_BANKED /*serial receive interrupt function */ interrupt void SCIrx_isr(void) #pragma CODE_SEG DEFAULT void main(void) unsigned char buffer[10]; DDRB = ; TSCR1 = ; TSCR2 = ; // software initialization G VandeBelt // message buffer // more local variables as required // data direction register PORT B as output // enable timer // set prescale for 1 MHz clock to timer

9 Question 3 : Continued while(1) // do forever loop G VandeBelt

10 Question 3 : Continued MCO556 // Initialize SCI void SCIopen(void) SCI0BDL=0xD0; /* /(16*2400)=>2400 bps 8MHz is Bus clock*/ SCI0BDH=0x00; /* 0x00,0x00D0 is divisor to produce 2400 bps */ SCI0CR2= ; /* enable SCI Rx interrupts */ // Output character to SCI void SCIputch(unsigned char Data) // Output a string to the SCI // Str[] is the string to be output void SCIputs(unsigned char Str[]) // Initialize ADC void ADCopen(void) ATD0CTL2 = ; // enable ADC ATD0CTL4 = 0x03; // Get a sample from the ADC unsigned char ADCgetSample(unsigned int chan) ATD0CTL5 = ; while( ); G VandeBelt // start sequence // wait for conversion complete // then take average of 4 conversions return (ATD0DR0H+ATD0DR1H+ATD0DR2H+ATD0DR3H)/4;

11 Question 4: MCO556 A DC level is applied to ADC channel 2 (channel numbers start at 0) via the level-shifting circuit in the lab. Note that full scale input range is -10V to +10V. a)the ADC converts this to an 8 bit value of hexadecimal 0xD5. What is the input voltage? b) The input voltage is changed to 4.0 Volts, what will be the hexadecimal value read from the ADC? Question 5: SCI 0 of a HCS12 microcontroller is connected a PC running Hyperterminal. The serial communications parameters are: Serial communications configuration: Use SCI bps 8 data bits no parity 1 stop bit receive interrupts enabled a) What hex values must be written to the Baud Rate registers and the control registers of the SCI to properly open the port? b) Using the values written to the baud rate registers, what is the actual baud rate of the communications link? (Show result to 4 digits of accuracy). G VandeBelt

12 MC9S12DP256B Timer System Registers TSCR1 TEN TEN = 1 : Timer enabled TSCR2 TOI PR2 PR1 PR0 TOI = 1 : Overflow interrupt enabled PR2-0 : Pre-scale value TCTL1 OM7 OL7 OM6 OL6 OM5 OL5 OM4 OL4 TCTL2 OM3 OL3 OM2 OL2 OM1 OL1 OM4 OL0 OMn OLn Action 0 0 No output 0 1 Toggle 1 0 Output Output 1 TIOS IOS7 IOS6 IOS5 IOS4 IOS3 IOS2 IOS1 IOS0 IOSn = 1 : Output compare IOSn = 0 : Input Capture TIE C7I C6I C5I C4I C3I C2I C1I C0I CnI = 1 : Channel n interrupt enabled TFLG1 C7F C6F C5F C4F C3I C2F C1F C0F CnF = 1 : Channel n event Write a 1 to clear TCn Channel n 16 bit capture/compare register G VandeBelt

13 MC9S12DP256B ADC Registers ATD0CTL2 ADPU ADPU : 0 = power down 1 = normal ATD0CTL5 ATDCTL5 DJM DSGN SCAN MULT 0 CC CB CC ADPU DJM : 0 = left justified DSGN: 0 = unsigned SCAN: 0 = single sequence MULT: 0 = single channel CC CB CA: channel ATD0STAT0 SCF SCF : 1 = conversion complete Cleared on write to ATD0CTL5 ATD0DRnH high byte of result data for Sample n MC9S12DP256B RTI Registers RTICTL 0 RTR6 RTR5 RTR4 RTR3 RTR2 RTR1 RTR0 RTR6-4 : RTI Pre-scale RTR3-0 : modulus (1-16) CRGINT RTIE 0 0 LOCKIE 0 0 SCMIE 0 RTIE : 1 = RTI interrupt enabled CRGFLG RTIF PORF 0 LOCKIF LOCK TRACK SCMIF SCM RTIF : 1 = RTI event G VandeBelt

14 MC9S12DP256B SCI Registers SCI0BDH SBR12 SBR11 SBR10 SBR9 SBR8 SBR12 0 = CLK/(16 * BR) SCI0BDL SBR7 SBR6 SBR5 SBR4 SBR3 SBR2 SBR1 SBR0 SCI0CR2 TIE TCIE RIE ILIE TE RE RWU SBK SCI0SR1 TDRE TC RDRF IDLE OR NF FE PF TE = 1 : Transmitter enabled RE = 1 : Receiver enabled RIE = 1 : Receive interrupt enabled TDRE = 1 : Transmitter empty RDRF = 1 : Receiver full SCI0DRL Transmit and receive data register Function prototypes for LCD driver void LCDopen(void); // initialize LCD driver void LCDputs(const char *s); // output a string void LCDputch(char data); // output a character void LCDclear(void); // clear display void LCDhome(void); // move cursor to home position void LCDline1(void); // move cursor to start of line 1 void LCDline2(void); // move cursor to start of line 2 void LCDline3(void); // move cursor to start of line 3 void LCDline4(void); // move cursor to start of line 4 Function prototypes for keypad driver void KPopen(void); char KPhit(void); char KPgetch(void); void KPflush(void); // initialize keypad driver // has a new key been pressed? // wait for and get a key press // discard possible keypress G VandeBelt

15 MC9S12DP256B Interrupt Vectors G VandeBelt

Asynchronous Data Transfer

Asynchronous Data Transfer Asynchronous Data Transfer In asynchronous data transfer, there is no clock line between the two devices Both devices use internal clocks with the same frequency Both devices agree on how many data bits

More information

A B C D E F 0480 FE B F5 3B FC F3 E 1A 1D 2A 2D 3A 3D 4A 4D 5A 5D 6A 6D 7A 7D

A B C D E F 0480 FE B F5 3B FC F3 E 1A 1D 2A 2D 3A 3D 4A 4D 5A 5D 6A 6D 7A 7D What's on the 9S12 bus as it executes a program The 9S12 Serial Communications Interface 9S12 Serial Communications Interface (SCI) Block Guide V02.05 Huang, Sections 9.2-9.6 Consider a 9S12 executing

More information

EE 308/MENG 483 Spring 2017

EE 308/MENG 483 Spring 2017 Exam II Review April 2017 Introduction to the MC9S12 Timer Subsystem The MC9S12 has a 16-bit counter that runs with a 24 MHz. The clock starts at 0x0000, counts up until it gets to 0xFFFF. It takes 2.7307

More information

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions Review for Exam 3 A/D Converter Power-up A/D converter (ATD0CTL2) Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions Write 0x85 to ATD0CTL4 to set at fastest conversion speed

More information

Dallas Semiconductor DS1307 Real Time Clock. The DS 1307 is a real-time clock with 56 bytes of NV (nonvolatile)

Dallas Semiconductor DS1307 Real Time Clock. The DS 1307 is a real-time clock with 56 bytes of NV (nonvolatile) Using the MC9S12 IIC Bus with DS 1307 Real Time Clock DS1307 Data Sheet Asynchronous Serial Communications The MC9S12 Serial Communications Interface (SCI) Dallas Semiconductor DS1307 Real Time Clock The

More information

EE345L Spring 2004 Final Version 3 Page 1 of 8

EE345L Spring 2004 Final Version 3 Page 1 of 8 EE345L Spring 2004 Final Version 3 Page 1 of 8 Jonathan W. Valvano May 12, 2004, 9am-12noon This is a closed book exam. You must put your answers in the boxes on the answer pages. You have 3 hours, so

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

HCS12 Serial Communications Interface (SCI) Block Guide V02.06

HCS12 Serial Communications Interface (SCI) Block Guide V02.06 DOCUMENT NUMBER S12SCIV2/D HCS12 Serial Communications Interface (SCI) Block Guide V02.06 Original Release Date: June 4, 1999 Revised: Oct 10, 2001 Motorola, Inc. Motorola reserves the right to make changes

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

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

EXCEPTIONS ON THE 9S12

EXCEPTIONS ON THE 9S12 EXCEPTIONS ON THE 9S12 Exceptions are the way a processor responds to things other than the normal sequence of instructions in memory. Exceptions consist of such things as Reset and Interrupts. Interrupts

More information

Lecture 13 Serial Interfaces

Lecture 13 Serial Interfaces CPE 390: Microprocessor Systems Spring 2018 Lecture 13 Serial Interfaces Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 Adapted from HCS12/9S12

More information

CS/ECE 5780/6780: Embedded System Design

CS/ECE 5780/6780: Embedded System Design CS/ECE 5780/6780: Embedded System Design John Regehr Lecture 16: SCI Register Configuration and Ritual SCI Register Information & Terminology The information in this lecture is found: Textbook pages 346-9.

More information

ECE/CS 5780/6780: Embedded System Design

ECE/CS 5780/6780: Embedded System Design ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 16: SCI Register Configuration and Ritual Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 1 / 19 Administrivia Schedule This is

More information

The MC9S12 Input Capture Function

The MC9S12 Input Capture Function The MC9S12 Input Capture Function The MC9S12 allows you to capture the time an external event occurs on any of the eight Port T PTT pins An external event is either a rising edge or a falling edge To use

More information

MICROCONTROLLER SYSTEM CONTROL DESIGN JON PRITCHARD SCOTT VON THUN

MICROCONTROLLER SYSTEM CONTROL DESIGN JON PRITCHARD SCOTT VON THUN MICROCONTROLLER SYSTEM CONTROL DESIGN JON PRITCHARD SCOTT VON THUN Problem Statement Create a simple feedback environment that can be used to demonstrate various feedback control systems using a microcontroller

More information

Interrupts. How can we synchronize with a peripheral? Polling

Interrupts. How can we synchronize with a peripheral? Polling Interrupts How can we synchronize with a peripheral? Polling run a program loop continually checking status of the peripheral wait for it to be ready for us to communicate with it Then handle I/O with

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

EE345L Fall 2008 Final Page 1 of 12

EE345L Fall 2008 Final Page 1 of 12 EE345L Fall 2008 Final Page 1 of 12 Jonathan W. Valvano First: Last: This is the closed book section. You must put your answers in the boxes on this answer page. When you are done, you turn in the closed-book

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

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

#include <hidef.h> /* common defines and macros */ #include <MC9S12XEP100.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12xep100"

#include <hidef.h> /* common defines and macros */ #include <MC9S12XEP100.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE mc9s12xep100 #include /* common defines and macros */ #include /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12xep100" #define LCD_RS PORTB_PB0 // Register select #define

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

EE345L Spring 2006 May 10, 2006, 2-5pm Page 1 of 8

EE345L Spring 2006 May 10, 2006, 2-5pm Page 1 of 8 EE345L Spring 2006 May 10, 2006, 2-5pm Page 1 of 8 Jonathan W. Valvano You can use the textbook, but no other materials. You must put your answers in the boxes on the answer pages. You have 3 hours, so

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

Objectives. Introduction

Objectives. Introduction Objectives - To establish bidirectional communications with an external host computer via the serial interface of the microcontroller - To write a set of functions f the input and output of clear text

More information

EE 308 Spring 2013 The MC9S12 A/D Converter

EE 308 Spring 2013 The MC9S12 A/D Converter The MC9S12 A/D Converter o Single Channel vs Multiple Channels o Singe Conversion vs Multiple Conversions o MC9S12 A/C Registers o Using the MC9S12 A/D Converter o A C program to use the MC9S12 A/D Converter

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

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

SCI Serial Communication Interface

SCI Serial Communication Interface SCI Serial Communication Interface Gerrit Becker James McClearen Charlie Hagadorn October 21, 2004 1 Learning Objectives of the Overview Knowledge of the general differences between serial and parallel

More information

; export symbols XDEF Entry ; export 'Entry' symbol ABSENTRY Entry ; for assembly entry point

; export symbols XDEF Entry ; export 'Entry' symbol ABSENTRY Entry ; for assembly entry point **************************************************************** * This program for CMPEN 472, Flash Memory Writing * * By Kyusun Choi, ID=0000 * * Date: 11/15/2017 * * Freescale CodeWarrior, for the HCS12C128

More information

CS/ECE 5780/6780: Embedded System Design

CS/ECE 5780/6780: Embedded System Design CS/ECE 5780/6780: Embedded System Design John Regehr Lecture 10: Interrupts in the 6812 General Features of Interrupts All interrupting systems must have the: Ability for the hardware to request action

More information

EE 308 Spring A software delay

EE 308 Spring A software delay A software delay To enter a software delay, put in a nested loop, just like in assembly. Write a function delay(num) which will delay for num milliseconds void delay(unsigned int num) volatile unsigned

More information

ECE/CS 5780/6780: Embedded System Design

ECE/CS 5780/6780: Embedded System Design ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 10: Interrupts in the 6812 Scott R. Little (Lecture 10: 6812 Interrupts) ECE/CS 5780/6780 1 / 35 General Features of Interrupts All interrupting

More information

General Features of Interrupts. ECE/CS 5780/6780: Embedded System Design. Stack Before and After an Interrupt. Sequence of Events During Interrupt

General Features of Interrupts. ECE/CS 5780/6780: Embedded System Design. Stack Before and After an Interrupt. Sequence of Events During Interrupt General Features of Interrupts ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 10: Interrupts in the 6812 All interrupting systems must have the: Ability for the hardware to request action

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

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

; export symbols ; export 'Entry' symbol. ; include derivative specific macros PORTA EQU $0000 PORTB EQU $0001 DDRA EQU $0002 DDRB EQU $0003

; export symbols ; export 'Entry' symbol. ; include derivative specific macros PORTA EQU $0000 PORTB EQU $0001 DDRA EQU $0002 DDRB EQU $0003 ******************************************************* * This program for CSE472, Flash Memory Writing * * By Kyusun Choi, ID=0000 * * Date: 11/14/2009 * * Freescale CodeWarrior, for the MC9S12C32 Program

More information

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly. More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems

More information

Lab 7: Asynchronous Serial I/O

Lab 7: Asynchronous Serial I/O CpE 390 Microprocessor Systems Lab 7: Asynchronous Serial I/O 1. Introduction Serial communications is the transfer of data, one bit at a time, over a communications channel. Serial communications can

More information

General Features of Interrupts. ECE/CS 5780/6780: Embedded System Design. Sequence of Events During Interrupt. Stack Before and After an Interrupt

General Features of Interrupts. ECE/CS 5780/6780: Embedded System Design. Sequence of Events During Interrupt. Stack Before and After an Interrupt General Features of Interrupts ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 9: Interrupts in the 6812 All interrupting systems must have the: Ability for the hardware to request action

More information

Lab 8 RS232 October 22, 2015

Lab 8 RS232 October 22, 2015 Lab 8 RS232 October 22, 2015 In this lab you will use the Serial Communications Interface (SCI) system on the HCS12 microcontroller to send and receive characters using the RS232 signal format. You will

More information

What Happens When You Reset the MC9S12?

What Happens When You Reset the MC9S12? What Happens When You Reset the MC9S12? What happens to the MC9S12 when you turn on power or push the reset button? How does the MC9S12 know which instruction to execute first? On reset the MC9S12 loads

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (Sept. 30, 2013) 1/15 538 Lecture Notes Week 5 Answers to last week's questions 1. With the diagram shown for a port (single bit), what happens if the Direction Register is read?

More information

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1 M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The

More information

Using Input Capture on the 9S12

Using Input Capture on the 9S12 The 9S12 Input Capture Function Huang Sections 8.1-8.5 ECT_16B8C Block User Guide o Interrupts on the 9S12 o Capturing the time of an external event o The 9S12 Input Capture Function o Registers used to

More information

ECE3120: Computer Systems Chapter 8: Timer Module

ECE3120: Computer Systems Chapter 8: Timer Module ECE32: Computer Systems Chapter 8: Timer Module Manjeera Jeedigunta http://blogs.cae.tntech.edu/msjeedigun2 Email: msjeedigun2@tntech.edu Tel: 93-372-68, Prescott Hall 2 Why are Timer Functions Important?

More information

CS/ECE 5780/6780: Embedded System Design

CS/ECE 5780/6780: Embedded System Design CS/ECE 5780/6780: Embedded System Design John Regehr Lecture 15: Serial I/O Devices Today Quick overview of serial communication in general SCI Serial Communication Interface SCI on the HCS12 Introduction

More information

Introduction to Serial Communication. ECE/CS 5780/6780: Embedded System Design. A Serial Channel. Definitions. SCI versus SPI.

Introduction to Serial Communication. ECE/CS 5780/6780: Embedded System Design. A Serial Channel. Definitions. SCI versus SPI. Introduction to Serial Communication ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 14: Serial I/O Devices Serial communication transmits of one bit of information at a time. One bit is

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (October 4, 2017) 1/18 538 Lecture Notes Week 5 Announements Midterm: Tuesday, October 25 Answers to last week's questions 1. With the diagram shown for a port (single bit), what

More information

SECTION 5 RESETS AND INTERRUPTS

SECTION 5 RESETS AND INTERRUPTS SECTION RESETS AND INTERRUPTS Resets and interrupt operations load the program counter with a vector that points to a new location from which instructions are to be fetched. A reset immediately stops execution

More information

ECE/CS 5780/6780: Embedded System Design. Introduction to Serial Communication

ECE/CS 5780/6780: Embedded System Design. Introduction to Serial Communication ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 15: Serial I/O Devices Scott R. Little (Lecture 15: Serial I/O) ECE/CS 5780/6780 1 / 69 Introduction to Serial Communication Serial communication

More information

Freescale Semiconductor, I

Freescale Semiconductor, I Engineering Bulletin Rev. 1, 2/2003 SCI Interrupt Errata Workaround for HCS12 Family Devices By: Gordon Doughman Field Applications Engineer, Software Specialist Dayton, Ohio Introduction NOTE: The purpose

More information

HC12 Built-In Hardware

HC12 Built-In Hardware HC12 Built-In Hardware The HC12 has a number of useful pieces of hardware built into the chip. Different versions of the HC12 have slightly different pieces of hardware. We are using the MC68HC912B32 chip

More information

EE 354 November 13, 2017 ARM UART Notes

EE 354 November 13, 2017 ARM UART Notes EE 354 November 13, 2017 ARM UART Notes For serial communications you should be familiar with the following terms: UART/USART Baud rate Synchronous/Asynchronous communication Half-Duplex/Full-Duplex The

More information

Menu. XMEGA 16-bit Timer/Counter Type 0 and Type 1 EEL 3744 EEL 3744

Menu. XMEGA 16-bit Timer/Counter Type 0 and Type 1 EEL 3744 EEL 3744 Menu Main Timer System for > XMEGA Timer System > 68HC11/12 Real-Time Interrupt/Counter (RTI/RTC) >68HC11/12 RTI Hardware and Registers RTI Programming Examples Use RTI interrupt; use RTIF & polling Free-running

More information

Module 3.F. Serial Communications Interface (SCI) Tim Rogers 2017

Module 3.F. Serial Communications Interface (SCI) Tim Rogers 2017 Module 3.F Serial Communications Interface (SCI) Tim Rogers 2017 Learning Outcome #3 An ability to effectively utilize the wide variety of peripherals integrated into a contemporary microcontroller How?

More information

ECE 4510/5530 Microcontroller Applications Week 9

ECE 4510/5530 Microcontroller Applications Week 9 ECE 45/553 Microcontroller Applications Week 9 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences Lab 7 & 8 Elements

More information

melabs Serial LCD Firmware Version 1.1 3/5/07

melabs Serial LCD Firmware Version 1.1 3/5/07 melabs Serial LCD Firmware Version 1.1 3/5/07 The melabs Serial LCD (SLCD) can display serial data from either asynchronous RS232-style or synchronous I 2 C input. A range of baud rates from 2400 to 57,600

More information

ABSTRACT: Code Warrior IDE Background Debug Mode (BDM) P&E USB MULTILINK

ABSTRACT: Code Warrior IDE Background Debug Mode (BDM) P&E USB MULTILINK ABSTRACT: The main aim of this project is to learn about the Code Warrior IDE for 68HCS12 (the project used special student version, download available in the www.metrowerks.com website) microcontroller

More information

The Freescale MC908JL16 Microcontroller

The Freescale MC908JL16 Microcontroller Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory The Freescale MC908JL16 Microcontroller by Allan G. Weber 1 Introduction The Freescale MC908JL16 (also called

More information

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to?

2. (2 pts) If an external clock is used, which pin of the 8051 should it be connected to? ECE3710 Exam 2. Name _ Spring 2013. 5 pages. 102 points, but scored out of 100. You may use any non-living resource to complete this exam. Any hint of cheating will result in a 0. Part 1 Short Answer 1.

More information

ECT_16B8C Block User Guide V01.06

ECT_16B8C Block User Guide V01.06 DOCUMENT NUMBER S12ECT16B8CV1/D ECT_16B8C Block User Guide V1.6 Original Release Date: 2-Sep-1999 Revised: Jul 5, 24 Motorola Inc. Motorola reserves the right to make changes without further notice to

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

CSE3215 Embedded Systems Laboratory

CSE3215 Embedded Systems Laboratory CSE3215 Embedded Systems Laboratory Lab3 Reaction Time Measurement Introduction Human reaction time is a parameter of interest in many psychological and physiological studies of the effects of drugs, stress,

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

Lecture 15 February 20, 2012 Introduction to the MC9S12 Timer Subsystem What Happens when you Reset the MC9S12. Introduction to Interrupts

Lecture 15 February 20, 2012 Introduction to the MC9S12 Timer Subsystem What Happens when you Reset the MC9S12. Introduction to Interrupts Lecture 15 February 20, 2012 Introduction to the MC9S12 Timer Subsystem What Happens when you eset the MC9S12 Introduction to Interrupts The MC9S12 has a 16-bit free-running counter to determine the time

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor

More information

CAN Protocol Implementation

CAN Protocol Implementation CAN Protocol Implementation Arun Pasupathi, Gaurav Agalave Electrical and Computer Engineering Department School of Engineering and Computer Science Oakland University, Rochester, MI e-mails: apasupathi@oakland.edu,

More information

538 Lecture Notes Week 7

538 Lecture Notes Week 7 538 Lecture Notes Week 7 (October 14, 2013) 1/12 538 Lecture Notes Week 7 Answers to last week's questions 1. Embedded System Programming in C C, developed to write UNIX (by the people who invented UNIX),

More information

LCD03 - I2C/Serial LCD Technical Documentation

LCD03 - I2C/Serial LCD Technical Documentation LCD03 - I2C/Serial LCD Technical Documentation Pagina 1 di 5 Overview The I2C and serial display driver provides easy operation of a standard 20*4 LCD Text display. It requires only a 5v power supply and

More information

Overview RFSv4.3 is a RF module providing easy and flexible wireless data transmission between devices. It is based on AVR Atmega8 with serial output which can be interfaced directly to PC. Features 2.4

More information

CMPEN 472 Sample EXAM II

CMPEN 472 Sample EXAM II CMPEN 472 Sample EXAM II Name: Student ID number (last 4 digit): Please write your name on every page. Write your solutions clearly. You may use backside of each page for scratch but the solutions must

More information

Bachelor of Engineering in Computer and Electronic Engineering

Bachelor of Engineering in Computer and Electronic Engineering Bachelor of Engineering in Computer and Electronic Engineering Computer Engineering 1 Year 2 Semester 3 Autumn 08 Niall O Keeffe Instructions to Candidates: - 2 hours duration Answer 4 out of 6 questions.

More information

School of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time:

School of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time: Student Information First Name School of Computer Science Faculty of Engineering and Computer Science Last Name Student ID Number Lab Cover Page Please complete all fields: Course Name: Structure and Application

More information

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

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING. BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017 TW34 UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017 INTERMEDIATE EMBEDDED SYSTEMS MODULE NO: EEE5004 Date: Thursday 12 January

More information

CMS-8GP32. A Motorola MC68HC908GP32 Microcontroller Board. xiom anufacturing

CMS-8GP32. A Motorola MC68HC908GP32 Microcontroller Board. xiom anufacturing CMS-8GP32 A Motorola MC68HC908GP32 Microcontroller Board xiom anufacturing 2000 717 Lingco Dr., Suite 209 Richardson, TX 75081 (972) 994-9676 FAX (972) 994-9170 email: Gary@axman.com web: http://www.axman.com

More information

EE445L Fall 2010 Final Version A Page 1 of 10

EE445L Fall 2010 Final Version A Page 1 of 10 EE445L Fall 2010 Final Version A Page 1 of 10 Jonathan W. Valvano First: Last: This is the closed book section. You must put your answers in the boxes on this answer page. When you are done, you turn in

More information

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт. SECOND шт. Assembly and С Programming forthefreescalehcs12 Microcontroller Fredrick M. Cady Department of Electrical and Computer Engineering Montana State University New York Oxford Oxford University

More information

Comparison of C and Assembly How to compile a C program using CodeWarrior

Comparison of C and Assembly How to compile a C program using CodeWarrior Comparison of C and Assembly How to compile a C program using CodeWarrior o Using pointers to access contents of specific addresses in C o Including and using derivative.h or hcs12.h to use in MC9S12 port

More information

LCD03 - I2C/Serial LCD Technical Documentation

LCD03 - I2C/Serial LCD Technical Documentation LCD03 - I2C/Serial LCD Technical Documentation 2YHUYLHZ The I2C and serial display driver provides easy operation of a standard 20*4 LCD Text display. It requires only a 5v power supply and the two data

More information

Lab 5: EBI and ADC: Digital Voltmeter

Lab 5: EBI and ADC: Digital Voltmeter Page 1/5 OBJECTIVES Learn how to use C (as an alternative to Assembly) in your programs. Learn how to use an analog-to-digital conversion (ADC, also known as A/D) system on a microcontroller. Use the ADC

More information

Department of Electronics and Instrumentation Engineering Question Bank

Department of Electronics and Instrumentation Engineering Question Bank www.examquestionpaper.in Department of Electronics and Instrumentation Engineering Question Bank SUBJECT CODE / NAME: ET7102 / MICROCONTROLLER BASED SYSTEM DESIGN BRANCH : M.E. (C&I) YEAR / SEM : I / I

More information

CET360 S12 DEMO PROGRAM #1 (C)

CET360 S12 DEMO PROGRAM #1 (C) CET360 S12 DEMO PROGRAM #1 (C) / ONE.C HCS12 Demo Program for CET360 13-Feb-2009 jss This program is the C implementation of ONE.ASM, the demo program that sets up port T as all outputs & increments it

More information

MTRX3700 Mechatronics

MTRX3700 Mechatronics MTRX3700 Mechatronics 3 2015 PIC18F452 Software Exercises David Rye You are to work in a group of two students to write, debug and demonstrate a series of small assembly language and C programs that meet

More information

Microcontroller and Embedded Systems:

Microcontroller and Embedded Systems: Microcontroller and Embedded Systems: Branches: 1. Electronics & Telecommunication Engineering 2. Electrical & Electronics Engineering Semester: 6 th Semester / 7 th Semester 1. Explain the differences

More information

LCD05 datasheet 1.0

LCD05 datasheet 1.0 LCD05 green displays LCD05 blue displays The I2C and serial display driver provides easy operation of a standard 20 x 4 or 16 x 2 LCD Text display. It requires only a 5v power supply and the two data connections

More information

Functional block diagram AD53x1 (Analog Devices)

Functional block diagram AD53x1 (Analog Devices) Objectives - To read the A/D converter and turn the converted digital value back into an analogue voltage using an external D/A converter. The entire cycle including ADC and DAC is to be run at a fixed

More information

How to use RFpro in Packet Mode

How to use RFpro in Packet Mode How to use RFpro in Packet Mode Jumper Setting Priority Jumper J1 à Configuration Mode Jumper à Higher Priority Jumper J2 à Packet Mode Jumper à Lower Priority When both the jumpers are connected, by default,

More information

Lab Course Microcontroller Programming

Lab Course Microcontroller Programming Technische Universität München Fakultät für Informatik Forschungs- und Lehreinheit Informatik VI Robotics and Embedded Systems Lab Course Microcontroller Programming Michael Geisinger geisinge@in.tum.de

More information

RS 232 Interface. RS 232 is the Serial interface on the PC. Three major wires for the Serial interface: Transmit Pin 2 Receive Pin 3

RS 232 Interface. RS 232 is the Serial interface on the PC. Three major wires for the Serial interface: Transmit Pin 2 Receive Pin 3 RS 232 Interface RS 232 is the Serial interface on the PC Three major wires for the Serial interface: Transmit Pin 2 Receive Pin 3 Note: SR510 switches pins 2,3 internally HP Func. Gen. Requires a null

More information

EE319K Fall 2006 Final A Page 1

EE319K Fall 2006 Final A Page 1 EE319K Fall 2006 Final A Page 1 First: Middle Initial: Last: This is a closed book exam. You must put your answers in the space provided. You have 3 hours, so allocate your time accordingly. Please read

More information

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1 SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1 Subject: Microcontroller and Interfacing (151001) Class: B.E.Sem V (EC-I & II) Q-1 Explain RISC

More information

Signature: 1. (10 points) Basic Microcontroller Concepts

Signature: 1. (10 points) Basic Microcontroller Concepts EE 109 Practice Final Exam Last name: First name: Signature: The practice final is one hour, ten minutes long, closed book, closed notes, calculators allowed. To receive full credit on a question show

More information

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

Reprinted by permission of T&L Publications Inc. Copyright 2001 USB MICROCONTROLLERS FOR THE MASSES Reprinted by permission of T&L Publications Inc. Copyright 2001 USB MICROCONTROLLERS FOR THE MASSES By Don L. Powrie Microcontroller, Flash programmer, and high speed USB-to-PC interface all in one tidy

More information

melabs Serial LCD Firmware Version 1.0 2/7/07

melabs Serial LCD Firmware Version 1.0 2/7/07 melabs Serial LCD Firmware Version 1.0 2/7/07 The melabs Serial LCD (SLCD) can display serial data from either asynchronous RS232-style or synchronous I 2 C input. A range of baud rates from 2400 to 57,600

More information

Embedded programming, AVR intro

Embedded programming, AVR intro Applied mechatronics, Lab project Embedded programming, AVR intro Sven Gestegård Robertz Department of Computer Science, Lund University 2017 Outline 1 Low-level programming Bitwise operators Masking and

More information

Features: Analog to Digital: 12 bit resolution TTL outputs, RS-232 tolerant inputs 4.096V reference (1mV/count) 115K max speed

Features: Analog to Digital: 12 bit resolution TTL outputs, RS-232 tolerant inputs 4.096V reference (1mV/count) 115K max speed The Multi-I/O expansion board gives users the ability to add analog inputs and outputs, UART capability (for GPS or modem) and isolated high current outputs to the Flashlite 386Ex. Available in several

More information

Comparison of C and Assembly How to compile a C program using CodeWarrior

Comparison of C and Assembly How to compile a C program using CodeWarrior Comparison of C and Assembly How to compile a C program using CodeWarrior o Using pointers to access contents of specific addresses in C o Including and using derivative.h or hcs12.h to use in MC9S12 port

More information

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram

History of the Microprocessor. ECE/CS 5780/6780: Embedded System Design. Microcontrollers. First Microprocessors. MC9S12C32 Block Diagram History of the Microprocessor ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 1: 68HC12 In 1968, Bob Noyce and Gordon Moore left Fairchild Semiconductor and formed Integrated Electronics

More information