Summary of the content on the page No. 1
MICROCOMPUTER MN101C
MN101C49G/49H/49K/F49K/P49K
LSI Application Notes Excerption
Pub.No.3144911-031E
Summary of the content on the page No. 2
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. (2) The technical information described in this book is intended only to show the main characteristics and application ci
Summary of the content on the page No. 3
About This Manual Configuration of This Manual This LSI application note is consists of the following sections. Chapter 1 Overview This chapter describes the overview of this application note. Chapter 2 Startup Program This chapter describes a startup process necessary for executing a program. Chapter 3 Register Setup of Each Function This chapter describes the setting method and setting examples of registers having MN101C49LSI function. Chapter 4 Sample Program 1 Th
Summary of the content on the page No. 4
Related Manuals Note that the following related documents are available. "MN101C49G/49H/49K/F49K/P49K LSI User's Manual" "MN101C Series C Compiler User's Manual: Language Description" "MN101C Series C Compiler User's Manual: Library Reference" "MN101C/MN101E Series C Compiler User's Manual: Usage Guide" "MN101C
Summary of the content on the page No. 5
Chapter 1 Overview 1 Chapter 2 Startup Program 2 Chapter 3 Register Setup of Each Function 3 Chapter 4 Sample Program 1 4 Chapter 5 Sample Program 2 5 Chapter 6 Appendix 1 6 Chapter 7 Appendix 2 7
Summary of the content on the page No. 6
Table of Contents Chapter 1 Overview ..................................................................................................................................................... 13 1.1 Overview ........................................................................................................................................................... 14 1.2 Startup Program................................................................................................................
Summary of the content on the page No. 7
3.6 How to Interrupt ................................................................................................................................................ 45 3.6.1 Interrupt vector table.................................................................................................................................. 45 3.6.2 Interrupt processing programs.................................................................................................................... 47 3.6.3 C
Summary of the content on the page No. 8
3.14.4 Setting communication speed for UART ............................................................................................... 106 3.14.5 Notes and applications related to communication channel..................................................................... 106 3.15 Data Transfer Function, Initializing Peripherals............................................................................................ 108 3.15.1 Setting in individual modes.............................
Summary of the content on the page No. 9
5.3 Sample Program Using Serial Function........................................................................................................... 219 5.3.1 Serial program.......................................................................................................................................... 219 5.3.2 Serial program 1....................................................................................................................................... 222 5.3.3 Serial pro
Summary of the content on the page No. 10
Chapter 3 Register Setup of Each Function 3.9 8-bit Timer, Initializing Peripherals There are five 8-bit timers comprising timer 0 to 4. The timer comprises a binary counter, a compare register and a mode register. You can combine two 8-bit timers, timer 0 and 1 or 2 and 3, to use as a 16-bit timer. Binary counter This counter counts a clock selected by the prescaler or the mode register. Compare register This register determines the time base of a timer by specifying clock number
Summary of the content on the page No. 11
Chapter 3 Register Setup of Each Function BIT3: "0" Stop count "1" Count operation BIT2, 1, 0: Clock source selection 000: High speed crystal clock oscillation frequency 001: Timer 1, prescaler output signal 010: Low speed crystal clock oscillation frequency 011: Synchronous low speed crystal clock oscillation frequency 110: Timer 1, pin input external signal 111: Synchronous timer 1, pin input external signal Timer 2: BIT7: Unused BIT6: Unused BIT5: "0" Normal operatio
Summary of the content on the page No. 12
Chapter 3 Register Setup of Each Function 001: Timer 3, prescaler output signal 010: Low speed crystal clock oscillation frequency 011: Synchronous low speed crystal clock oscillation frequency 110: Timer 3, pin input external signal 111: Synchronous timer 3, pin input external signal Timer 4: BIT7: Unused BIT6: Unused BIT5: "0" Normal operation "0" P24(IRQ4), pulse width measurement BIT4: "0" Normal operation "1" PWM operation BIT3: "0" Stop count "1" Count ope
Summary of the content on the page No. 13
Chapter 3 Register Setup of Each Function 20 MHz / 64 = 312500 312500 / 100 = 3125 This setting is not available with the 8-bit timer. Setting by using low speed oscillation clock: 32.768 kHz/ 4 = 8192 8192 / 100 = 81.92 = approx. 82 If you set the formula 82 − 1 = 81, the interval timer with 10 milli seconds will be set. The following section describes a sample program. /* Control data declaration */ #define TM0MOD 0x00 /* 0b00000000 Normal timer operation */ #define TM0PWM 0
Summary of the content on the page No. 14
Chapter 3 Register Setup of Each Function #define TM0BC (*(volatile unsigned char *)TM0BC_adr) #define TM0OC_adr 0x3F52 #define TM0OC (*(volatile unsigned char *)TM0OC_adr) #define TM0MD_adr 0x3F54 #define TM0MD (*(volatile unsigned char *)TM0MD_adr) #define CK0MD_adr 0x3F56 #define CK0MD (*(volatile unsigned char *)CK0MD_adr) /* Setting program*/ /* Operation is based on external signal, and prescaler is not set */ TM0OC = COUNT; /* Set timer value */ TM0MD = TM0CAS | TM0
Summary of the content on the page No. 15
Chapter 3 Register Setup of Each Function TMxIO (x is the timer number) Compare register value 8-bit timer overflow cycle 128 Hz Figure 3 8-bit timer PWM operation timing chart The following section describes a sample program. /* Control data declaration */ #define TM4MOD 0x00 /* 0b00000000 Pulse width measurement control (normal timer operation)*/ #define TM4PWM 0x10 /* 0b00010000 PWM operation */ #define TM4EN 0x08 /* 0b00001000 Count operation */ #define TM
Summary of the content on the page No. 16
Chapter 3 Register Setup of Each Function the interval output for the interval timer. Serial interface transfer clock generation You can use the ouput signal from a timer to generate a serial transfer clock. You can use the interval timer and timer output setting to set the timer. The following timers are available for the serial interface communication. Timer 2 Timer 3 Timer 4 Serial 0 Available Not available Available Serial 1 Not available Not available Available Serial 2 Not
Summary of the content on the page No. 17
Chapter 3 Register Setup of Each Function /* Register address declaration */ #define TM2BC_adr 0x3F58 #define TM2BC (*(volatile unsigned char *)TM2BC_adr) #define TM2OC_adr 0x3F5A #define TM2OC (*(volatile unsigned char *)TM2OC_adr) #define TM2MD_adr 0x3F5C #define TM2MD (*(volatile unsigned char *)TM2MD_adr) #define CK2MD_adr 0x3F5E #define CK2MD (*(volatile unsigned char *)CK2MD_adr) /* Setting program */ CK2MD = TM2PSC; /* Set prescaler */ TM2OC = TIME; /* Se
Summary of the content on the page No. 18
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://panaso
Summary of the content on the page No. 19
SALES OFFICES NORTH AMERICA ASIA U.S.A. Sales Office: Singapore Sales Office: Panasonic Industrial Company [PIC] Panasonic Semiconductor Sales Asia [PSCSA] New Jersey Office: 300 Beach Road, #16-01, the Concourse, Singapore 199555, the 2 Panasonic Way Secaucus, New Jersey 07094, U.S.A. Republic of Singapore Tel:1-201-348-5257 Fax:1-201-392-4652 Tel:65-6390-3688 Fax:65-6390-3689 Chicago Office: Malaysia Sales Office: 1707 N. Randall Road Elgin, Illinois 60123-7847, U.