MICROCOMPUTER MN101C MN101C49G/49H/49K/F49K/P49K 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 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.
■ 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"
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
Table of Contents Chapter 1 Overview ..................................................................................................................................................... 13 1.1 Overview ........................................................................................................................................................... 14 1.2 Startup Program...................................................................................................................................
3.6 How to Interrupt ................................................................................................................................................ 45 3.6.1 Interrupt vector table.................................................................................................................................. 45 3.6.2 Interrupt processing programs.................................................................................................................... 47 3.6.3 Checking interrupt .
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................................................
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 program 2.............
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.
Chapter 3 Register Setup of Each Function BIT3: "0" "1" Stop count 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" "1" BIT4: "0" "1" BIT3: "0" "1" Normal operation
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" "0" BIT4: "0" "1" BIT3: "0" "1" Normal operation P24(IRQ4), pulse width measurement Normal operation PWM operation Stop count Count operation BIT2, 1, 0: Clock source selection 0
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.
Chapter 3 Register Setup of Each Function #define #define #define #define #define #define #define TM0BC TM0OC_adr 0x3F52 TM0OC TM0MD_adr 0x3F54 TM0MD CK0MD_adr 0x3F56 CK0MD (*(volatile unsigned char *)TM0BC_adr) (*(volatile unsigned char *)TM0OC_adr) (*(volatile unsigned char *)TM0MD_adr) (*(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 | TM0EN | TM0CK; This sample is store
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.
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.
Chapter 3 Register Setup of Each Function /* Register address declaration */ #define TM2BC_adr 0x3F58 #define TM2BC (*(volatile #define TM2OC_adr 0x3F5A #define TM2OC (*(volatile #define TM2MD_adr 0x3F5C #define TM2MD (*(volatile #define CK2MD_adr 0x3F5E #define CK2MD (*(volatile unsigned char *)TM2BC_adr) unsigned char *)TM2OC_adr) unsigned char *)TM2MD_adr) unsigned char *)CK2MD_adr) /* Setting program */ CK2MD = TM2PSC; /* Set prescaler */ TM2OC = TIME; /* Set timer value */ TM2MD = TM2MOD | TM2PWM | T
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.