MICROCOMPUTER MN103S MN103S927/92A/F92G LSI Application Notes Excerption Pub.No.
Request for your special attention and precautions in using the technical information and semiconductors described in this book (1) If any of the products or technical information described in this book is to be exported or provided to non-residents, the laws and regulations of the exporting country, especially, those with regard to security export control, must be observed.
About This Manual ■ Configuration of This Manual This LSI application note consists of the following sections. • Overview: This section presents a brief description of this LSI's overview and features as information useful for selecting and using a microcomputer. • Introduction: This section describes a sample program that implements this LSI's basic functions.
Format used for sample program explanations The sample programs included in the Introduction, Microcomputer Basics are explained in the following order of headings. Unnecessary headings may be omitted depending on their sample program. • Specification • Hardware allocation list • Register description • Flowchart • Example program The following oscillation frequencies this documentís sample programs use: fosc = 10 MHz, fx = 32.768 kHz.
About This Manual3
..
Table of Contents Chapter 1 Overview 1.1 Overview ................................................................................................................................2 1.2 What is an MN103S92 Series microcomputer .......................................................................3 1.3 MN103S92 Series internal configuration ...............................................................................4 1.4 MN103S92 Series features ......................................................
2.6.3 2.6.4 2.6.5 2.7 Serial interface UART transmission interrupt ................................................................48 A/D conversion interrupt ................................................................................................50 Enable multiple interrupts ..............................................................................................52 Main routine ....................................................................................................................
3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.7 Counting rising edges using the event count ..................................................................37 Setting timer output pin ..................................................................................................44 50 kHz signal output using the timer output ..................................................................47 Interrupt generation every 100 milli seconds using the cascade connection of timer 0 and timer 1 ...........................
4.2 Writing in/reading from EEPROM using synchronous serial interface .................................3 4.3 120 degrees power on PWM output .....................................................................................22 4.4 Sin wave PWM output using motor control PWM ..............................................................37 Chapter 5 Appendix 5.1 Appendix-1 .............................................................................................................................
Table of Contents 5
Chapter 3 Microcomputer Basics 1 3.6 8-bit timer operation 3.6.1 Counting rising edges using the event count ■ Overview This program uses Timer 1 to count the rising edges of the external signal input from the TM1IO input pin with a binary counter. When the external input signal is detected 5 times, an interrupt is generated and LED connected to P44 flashes. The setting stored in the base register determines the number of rising edge detections that is counted until an interrupt is generated.
Chapter 3 Microcomputer Basics 1 ■ Register description Group 4 Interrupt Control Register (G4ICR: 0x00008910) bp Flag name Description 15 14-12 G4LV2 G4LV1 G4LV0 Group 4 interrupt priority level Set a level from 6 to 0.
Chapter 3 Microcomputer Basics 1 Timer 1 Binary Counter (TM1BC: 0x0000A151) bp Flag name Description 7 6 5 4 3 2 1 0 TM1BC7 TM1BC6 TM1BC5 TM1BC4 TM1BC3 TM1BC2 TM1BC1 TM1BC0 Timer 1 binary counter Timer 1 Mode Register (TM1MD: 0x0000A141) bp Flag name Description 7 TM1CNE Timer operation enable 0: Operation disabled 1: Operation enabled 6 TM1LDE Timer initialization 0: Normal operation 1: Initialization TM1BR value is loaded into TM1BC. Timer pulse output 1 is reset to low level.
Chapter 3 Microcomputer Basics 1 Port 3 Output Mode Register (P3MD: 0x0000A033) III−40 bp Flag name Description 7-4 3 P33M Switching outputs 0: I/O port 1: TM3IO 2 P32M Switching outputs 0: I/O port 1: TM2IO 1 P31M Switching outputs 0: I/O port 1: TM1IO 0 P30M Switching outputs 0: I/O port 1: TM0IO 8-bit timer operation
Chapter 3 Microcomputer Basics 1 ■ Flowchart main () Initialize CPU Set P44 output Set Timer 1 input pin Set the base register Set count clock source Initialize Timer 1 Select Timer 1 normal operation Set an interrupt level Enable the interrupt Start event Binary counter underflow int_timer1 () P44 state Low (LED off) High output (LED on) High (LED on) Low output (LED off) END 8-bit timer operation III−41
Chapter 3 Microcomputer Basics 1 ■ Example program /************************************************************************/ /* CHECK Program for The count of the rising edge */ /* which used event count operation(8-bit) */ /************************************************************************/ /* Setting of Main Peripheral */ /* Port 0 : Unused */ /* Port 1 : Unused */ /* Port 2 : Unused */ /* Port 3 : Used as Timer 1 input */ /* Port 4 : Used as output port */ /* Port 5 : Unused */ /* Port 6 : Unused
Chapter 3 Microcomputer Basics 1 asm (" asm (" nop\n"); nop\n"); TM1MD = TM1MD | 0x80; /* Start the counter */ while(1){ } } /*---------------------------------------------Operation initial setting ----------------------------------------------*/ void initialize(void) { asm (" and 0xF0FF,PSW\n"); /* Disable all maskable interrupts */ asm (" nop\n"); asm (" nop\n"); CPUM = 0x0000; /* Set normal mode */ } /*----------------------------------------------Timer 1 underflow -------------------------------
Inquiries If you have questions regarding technical information on this manual, please visit the following URL. User Support Team Semiconductor Company Matsushita Electric Industrial Co., Ltd. URL: http://panasonic.co.jp/semicon/e-micom/inquiry For inquiries regarding Microcomputer, • Microcomputer Web site We offer you technical information regarding microcomputers at http://panasonic.co.jp/semicon/e-micom. • Microcomputer Manual Download Site http://panasonic.co.
SALES OFFICES NORTH AMERICA ASIA U.S.A. Sales Office: Panasonic Industrial Company [PIC] New Jersey Office: 2 Panasonic Way Secaucus, New Jersey 07094, U.S.A. Tel:1-201-348-5257 Fax:1-201-392-4652 Chicago Office: 1707 N. Randall Road Elgin, Illinois 60123-7847, U.S.A. Tel:1-847-468-5720 Fax:1-847-468-5725 San Jose Office: 2033 Gateway Place, Suite 200, San Jose, California 95110, U.S.