Fujitsu Semiconductor Design (Chengdu) Co., Ltd. User Manual MCU-UM-510107-E-11 32-BIT MICROCONTROLLER MB9AA30N SERIES BLUEMOON-EVB FIRMWARE USER MANUAL ARM and Cortex-M3 are the trademarks of ARM Limited in the EU and other countries. Bluemoon-EVB Firmware V1.1.0 Revision History Revision History Version Date Updated by Approved by Modifications 1.0.0 2012-10-29 Abel Ma First Draft 1.1.0 2012-11-27 Abel Ma Modify some content in chapter 5 This manual contains 31 pages. Specifications are subject to change without notice. For further information please contact each office. All Rights Reserved. The contents of this document are subject to change without notice. Customers are advised to consult with sales representatives before ordering. The information, such as descriptions of function and application circuit examples, in this document are presented solely for the purpose of reference to show examples of operations and uses of FUJITSU SEMICONDUCTOR device; FUJITSU SEMICONDUCTOR does not warrant proper operation of the device with respect to use based on such information. When you develop equipment incorporating the device based on such information, you must assume any responsibility arising out of such use of the information. FUJITSU SEMICONDUCTOR assumes no liability for any damages whatsoever arising out of the use of the information. Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of FUJITSU SEMICONDUCTOR or any third party or does FUJITSU SEMICONDUCTOR warrant non-infringement of any third-party's intellectual property right or other right by using such information. FUJITSU SEMICONDUCTOR assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would result from the use of information contained herein. The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible repeater and artificial satellite). Please note that FUJITSU SEMICONDUCTOR will not be liable against you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. Exportation/release of any products described in this document may require necessary procedures in accordance with the regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws. The company names and brand names herein are the trademarks or registered trademarks of their respective owners. Copyright © 2012 Fujitsu Semiconductor Design (Chengdu) Co., Ltd. All rights reserved. MCU-UM-510107-E-11 – Page 2 Bluemoon-EVB Firmware V1.1.0 Contents Contents REVISION HISTORY ............................................................................................................ 2 CONTENTS .......................................................................................................................... 3 1 INTRODUCTION .............................................................................................................. 6 1.1 Purpose ................................................................................................................... 6 1.2 Document Overview ................................................................................................ 6 2 SYSTEM HARDWARE ENVIRONMENT ......................................................................... 7 3 DEVELOPMENT ENVIRONMENT ................................................................................... 8 4 SYSTEM FUNCTION ....................................................................................................... 9 4.1 Macro Define ........................................................................................................... 9 4.2 Function List ............................................................................................................ 9 4.3 Function Prototype ................................................................................................ 10 4.3.1 Sys_Init () ................................................................................................ 10 4.3.2 StatusSeverveRun () ............................................................................... 10 4.3.3 KeyScanf() ............................................................................................... 10 4.3.4 KeyTouchServe () .................................................................................... 10 4.3.5 DispModeServe () .................................................................................... 11 4.3.6 MinSysCurTest() ...................................................................................... 11 4.3.7 RtcModeSet() .......................................................................................... 11 4.3.8 EnterLowerPowerModeProcess () ........................................................... 11 4.3.9 TscKeyScanf () ........................................................................................ 12 4.3.10 uint8_t TSCKey_UpdateBaseline(uint8_t) ................................................ 12 5 EVENT FUNCTION ........................................................................................................ 13 5.1 Function List .......................................................................................................... 13 5.2 Function Prototype ................................................................................................ 13 5.2.1 LcdBlc_Init ()............................................................................................ 13 5.2.2 InitRTC(uint8_t) ....................................................................................... 14 5.2.3 LedWork_Init () ........................................................................................ 14 5.2.4 CommonDvc_Init () .................................................................................. 14 5.2.5 ModChgKey_Init() .................................................................................... 14 5.2.6 JoyKey_Init () ........................................................................................... 15 5.2.7 ShowPage1 () .......................................................................................... 15 5.2.8 TSCKey_Init() .......................................................................................... 15 5.2.9 ShowDatePage() ..................................................................................... 15 MCU-UM-510107-E-11 – Page 3 Bluemoon-EVB Firmware V1.1.0 Contents 5.2.10 ShowTimePage() ..................................................................................... 16 5.2.11 uint8_t LeapYearCheck(uint8_t) .............................................................. 16 5.2.12 LcdBuffer_Clr() ........................................................................................ 16 5.2.13 LcdWriteData(uint8_t, uint8_t, uint8_t) ..................................................... 16 5.2.14 LcdWriteColon(uint8_t) ............................................................................ 17 5.2.15 LcdDisp_Clr() ........................................................................................... 17 5.2.16 ShowWhichPlaceBlink(uint8_t, uint8_t, uint8_t) ....................................... 17 5.2.17 TimePageSet(uint8_t, uint8_t, uint8_t) ..................................................... 17 5.2.18 DatePageSet(uint8_t, uint8_t, uint8_t) ..................................................... 18 5.2.19 SetAllGpioOutH() ..................................................................................... 18 6 DRIVER FUNCTION ...................................................................................................... 19 6.1 Function List .......................................................................................................... 19 6.2 Function Prototype ................................................................................................ 19 6.2.1 Gpio_Init (McuPinName, uint8_t, uint8_t)................................................. 19 6.2.2 uint8_t GpioInputCheck(McuPinName, uint8_t) ....................................... 20 6.2.3 uint8_t MultiAdcFun(McuPinName).......................................................... 20 6.2.4 uint8_t MultiLcdFun (McuPinName) ......................................................... 20 6.2.5 uint8_t MultiMainClockFun(McuPinName) ............................................... 20 6.2.6 uint8_t MultiSubClockFun(McuPinName)................................................. 21 6.2.7 LcdComPin_Init (uint8_t) ......................................................................... 21 6.2.8 LcdSegPin_Init () ..................................................................................... 21 6.2.9 LCD_Init() ................................................................................................ 21 6.2.10 LCD_Disable () ........................................................................................ 22 6.2.11 LcdDisp() ................................................................................................. 22 6.2.12 BT0ReloadTimer_Init()............................................................................. 22 6.2.13 BT0Timer_Halt() ...................................................................................... 22 6.2.14 BT0Timer_Resume() ............................................................................... 23 6.2.15 Eint_Init(McuPinName, uint8_t) ............................................................... 23 6.2.16 Eint_Disable(McuPinName) ..................................................................... 23 6.2.17 Lvd_Init() ................................................................................................. 23 7 INTERRUPT FUNCTION................................................................................................ 24 7.1 Function List .......................................................................................................... 24 7.2 Function Prototype ................................................................................................ 24 7.2.1 BT_IRQHandler() ..................................................................................... 24 7.2.2 INT07_7_Handler() .................................................................................. 24 7.2.3 LVD_Handler() ......................................................................................... 24 8 DEMO SYSTEM ............................................................................................................. 25 MCU-UM-510107-E-11 – Page 4 Bluemoon-EVB Firmware V1.1.0 Contents 8.1 System Introduction............................................................................................... 25 8.2 System Features ................................................................................................... 25 8.3 System Firmware Design ...................................................................................... 26 8.3.1 User Interface .......................................................................................... 26 8.3.2 System Main Loop ................................................................................... 27 8.3.3 System Files ............................................................................................ 28 8.3.4 System Files Structure ............................................................................. 29 9 ADDITIONAL INFORMATION ....................................................................................... 30 10 APPENDIX ..................................................................................................................... 31 10.1 List of Figures and Tables ..................................................................................... 31 MCU-UM-510107-E-11 – Page 5 Bluemoon-EVB Firmware V1.1.0 Chapter 1 Introduction 1 Introduction 1.1 Purpose This user manual describes FUJITSU Bluemoon EV Board, and the firmware configuration. The firmware main includes TSC, RTC, LCD, ADC, LPCM, LVD, Key driver and so on functions. 1.2 Document Overview The rest of document is organized as the following: Chapter 2 explains System Hardware Environment. Chapter 3 explains Development Environment. Chapter 4 explains System Function. Chapter 5 explains Event Function. Chapter 6 explains Driver Function. Chapter 7 explains Interrupt Function. Chapter 8 explains Demo System. MCU-UM-510107-E-11 – Page 6 Bluemoon-EVB Firmware V1.1.0 Chapter 2 System Hardware Environment 2 System Hardware Environment Hardware Environment CPU Chip: Fujitsu MB9AA30N; CPU Frequency: 20MHz; Minimum Instruction Time: 50ns; Ram Space: 1KBytes; Code Space: 14KBytes; MCU-UM-510107-E-11 – Page 7 Bluemoon-EVB Firmware V1.1.0 Chapter 3 Development Environment 3 Development Environment Development Environment Table 3-1: MCU Development Environment Name Description Part Number IAR bedded Workbench FW development and debug JLink Debug and Load FW Manufacture MCU-UM-510107-E-11 – Page 8 Remark Bluemoon-EVB Firmware V1.1.0 Chapter 4 System Function 4 System Function Note: More information about RTC, refer to FUJITSU MCU-AN-510045-E-10.pdf. 4.1 Macro Define Name Description Value Mark POWER_SUPPLY_TIME The time of watching power changed cycle 200 ms DisplayKeyModeTime How long about display current time 5000 ms TSCKEY_OffsetL3 Adjust TSC key sensitivity 40 N/A LedIndicateTime The time about LED to indicated if touch key 500 ms LCD_BLINK_TIME The time about LCD blink in RTC setting mode 500 ms LcdBackOff() Close LCD backlight N/A N/A LcdBackOn() Open LCD backlight N/A N/A LedWorkOn() Open D2 N/A N/A LedWorkOff() Close D2 N/A N/A 4.2 Function List Prototype Description Remark void Sys_Init (void) System initialization call in the system first void StatusServeRun (void) LED indication base on system status N/A void KeyScanf (void) Key scan N/A void KeyTouchServe (void) Judgment if have a key N/A void DispModeServe (void) System status judgment N/A void MinSysCurTest (void) Enter test mode N/A void RtcModeSet (void) Enter RTC setting mode N/A void EnterLowerPowerModeProcess (void) Enter low power consumption mode N/A void TscKeyScanf(void) TSC key scan N/A uint8_t TSCKey_UpdateBaseline(uint8_t) Update TSC base line TSC Lib MCU-UM-510107-E-11 – Page 9 Bluemoon-EVB Firmware V1.1.0 Chapter 4 System Function 4.3 Function Prototype 4.3.1 Sys_Init () Prototype void Sys_Init(void) Parameter: void Return void Description Initialize system Remark N/A 4.3.2 StatusSeverveRun () Prototype void StatusServeRun (void) Parameter: void Return void Description LED indication base on system status Remark N/A 4.3.3 KeyScanf() Prototype void KeyScanf (void) Parameter: void Return void Description Key scan Remark N/A 4.3.4 KeyTouchServe () Prototype void KeyTouchServe (void) Parameter: void Return void Description Judgment if have a key Remark N/A MCU-UM-510107-E-11 – Page 10 Bluemoon-EVB Firmware V1.1.0 Chapter 4 System Function 4.3.5 DispModeServe () Prototype void DispModeServe (void) Parameter: void Return void Description System status judgment Remark N/A 4.3.6 MinSysCurTest() Prototype void MinSysCurTest (void) Parameter: void Return void Description Enter test mode Remark N/A 4.3.7 RtcModeSet() Prototype void RtcModeSet (void) Parameter: void Return void Description Enter RTC setting mode Remark N/A 4.3.8 EnterLowerPowerModeProcess () Prototype void EnterLowerPowerModeProcess (void) Parameter: void Return void Description Enter low power consumption mode Remark N/A MCU-UM-510107-E-11 – Page 11 Bluemoon-EVB Firmware V1.1.0 Chapter 4 System Function 4.3.9 TscKeyScanf () Prototype void TscKeyScanf(void) Parameter: void Return void Description TSC key scan Remark N/A 4.3.10 uint8_t TSCKey_UpdateBaseline(uint8_t) Prototype uint8_t TSCKey_UpdateBaseline(uint8_t Key_Num) Parameter: Key_Num: Indication the number of touch keys need filter Return 1 -- OK Description Update TSC base line Remark N/A other -- Error MCU-UM-510107-E-11 – Page 12 Bluemoon-EVB Firmware V1.1.0 Chapter 5 Event Function 5 Event Function Note: More information about RTC, refer to FUJITSU MCU-AN-510045-E-10.pdf. 5.1 Function List Prototype Description Remark void LcdBlc_Init(void) Init LCD back light controller N/A void InitRTC(uint8_t) Init RTC function N/A void LedWork_Init(void) Init MCU status indication led, as GPIO output N/A void CommonDvc_Int(void) Init common device, eg: LCD backlight, LED N/A void ModChgKey_Init(void) Init mode change key, as GPIO input N/A void JoyKey_Init(void) Init mode Joystick key, as GPIO input N/A void ShowPage1(void) Display the "FUJITSU" N/A void TSCKey_Init(unsigned char) TSC initialization N/A void ShowDatePage(void) Display the page 2 eg: Year-Month-Day N/A void ShowTimePage(void) Display the page 1 eg: Hour:Min:Sec N/A uint8_t LeapYearCheck(uint8_t ) Check the input year, if leap? N/A void LcdBuffer_Clr(void) Clean LCD display buffer N/A void LcdWriteData(uint8_t, uint8_t, uint8_t) Write data to LCD display buffer N/A void LcdWriteColon(uint8_t ) Write colon to LCD display buffer N/A void LcdDisp_Clr(void) Clean the LCD display N/A void ShowWhichPlaceBlink(uint8_t, uint8_t, uint8_t) Appoint a place, the display is blink N/A void TimePageSet(uint8_t, uint8_t , uint8_t ) In setting time mode, display the page 1 eg: Hour:Min:Sec N/A void DatePageSet(uint8_t, uint8_t , uint8_t ) In setting time mode, display the page 2 eg: YearMonth-Day N/A void SetAllGpioOutH(void) Set GPIO status for low power consumption mode N/A 5.2 Function Prototype 5.2.1 LcdBlc_Init () Prototype void LcdBlc_Init(void) Parameter: void Return void Description Init LCD back light controller Remark N/A MCU-UM-510107-E-11 – Page 13 Bluemoon-EVB Firmware V1.1.0 Chapter 5 Event Function 5.2.2 InitRTC(uint8_t) Prototype void InitRTC(uint8_t EnableWriteRtc) Parameter: EnableWriteRtc: Enable write the date & time Return void Description Initialize RTC function Remark N/A 0x1 -- enable 5.2.3 LedWork_Init () Prototype void LedWork_Init(void) Parameter: void Return void Description Init MCU status indication led, as GPIO output Remark N/A 5.2.4 CommonDvc_Init () Prototype void CommonDvc_Init(void) Parameter: void Return void Description Init common device, eg: LCD backlight, Beep, LED Remark N/A 5.2.5 ModChgKey_Init() Prototype void ModChgKey_Init(void) Parameter: void Return void Description Init mode change key, as GPIO input Remark N/A MCU-UM-510107-E-11 – Page 14 other -- disable Bluemoon-EVB Firmware V1.1.0 Chapter 5 Event Function 5.2.6 JoyKey_Init () Prototype void JoyKey_Init(void) Parameter: void Return void Description Init mode Joystick key, as GPIO input Remark N/A 5.2.7 ShowPage1 () Prototype void ShowPage1(void) Parameter: void Return void Description Display the "FUJITSU" Remark N/A 5.2.8 TSCKey_Init() Prototype void TSCKey_Init(unsigned char) Parameter: void Return void Description TSC initialization Remark N/A 5.2.9 ShowDatePage() Prototype void ShowDatePage(void) Parameter: void Return void Description Display the page 2 eg: Year-Month-Day Remark N/A MCU-UM-510107-E-11 – Page 15 Bluemoon-EVB Firmware V1.1.0 Chapter 5 Event Function 5.2.10 ShowTimePage() Prototype void ShowTimePage(void) Parameter: void Return void Description Display the page 1 eg: Hour:Min:Sec Remark N/A 5.2.11 uint8_t LeapYearCheck(uint8_t) Prototype uint8_t LeapYearCheck(uint8_t Year) Parameter: Year: input the year Return 1 -- year Description Check the input year, if leap? Remark N/A other -- not 5.2.12 LcdBuffer_Clr() Prototype void LcdBuffer_Clr(void) Parameter: void Return void Description Clean LCD display buffer Remark N/A 5.2.13 LcdWriteData(uint8_t, uint8_t, uint8_t) Prototype void LcdWriteData(uint8_t dat, uint8_t place, uint8_t point) Parameter: dat: needs display data place: place of display point: if display radix point 1 -- yes other -- no Return void Description Write data to LCD display buffer Remark N/A MCU-UM-510107-E-11 – Page 16 Bluemoon-EVB Firmware V1.1.0 Chapter 5 Event Function 5.2.14 LcdWriteColon(uint8_t) Prototype void LcdWriteColon(uint8_t place) Parameter: place: display place Return void Description Write colon to LCD display buffer Remark N/A 5.2.15 LcdDisp_Clr() Prototype void LcdDisp_Clr (void) Parameter: void Return void Description Clean the LCD display Remark N/A 5.2.16 ShowWhichPlaceBlink(uint8_t, uint8_t, uint8_t) Prototype Parameter: void ShowWhichPlaceBlink(uint8_t WhichPlace, uint8_t ReplaceDate1, uint8_t ReplaceDate2) Place: place of blink display ReplceDate1: needs replace data in place ReplceDate2: needs replace data in place+1 Return void Description A point a place, the display is blink Remark N/A 5.2.17 TimePageSet(uint8_t, uint8_t, uint8_t) Prototype void TimePageSet(uint8_t hour, uint8_t min, uint8_t sec) Parameter: hour: the current hour min: the current minute sec: the current second Return void Description In setting time mode, display the page 1 eg: Hour:Min:Sec Remark N/A MCU-UM-510107-E-11 – Page 17 Bluemoon-EVB Firmware V1.1.0 Chapter 5 Event Function 5.2.18 DatePageSet(uint8_t, uint8_t, uint8_t) Prototype void DatePageSet(uint8_t year, uint8_t month, uint8_t date) Parameter: year: the current year month: the current month date: the current day Return void Description In setting time mode, display the page 2 eg: Year-Month-Day Remark N/A 5.2.19 SetAllGpioOutH() Prototype void SetAllGpioOutH(void) Parameter: void Return void Description Set GPIO status Remark N/A MCU-UM-510107-E-11 – Page 18 Bluemoon-EVB Firmware V1.1.0 Chapter 6 Driver Function 6 Driver Function Note: More information about RTC, refer to FUJITSU MCU-AN-510045-E-10.pdf. 6.1 Function List Prototype Description Remark void Gpio_Init(McuPinName, uint8_t, uint8_t) Set a GPIO pin as input or output N/A uint8_t GpioInputCheck (McuPinName, uint8_t) When a pin used as GPIO input, check if a key N/A uint8_t MultiAdcFun(McuPinName) Judgment if the pin has ADC function N/A uint8_t MultiLcdFun(McuPinName) Judgment if the pin has LCD function N/A uint8_t MultiMainClockFun(McuPinName) Judgment if the pin has Main clock function N/A uint8_t MultiSubClockFun(McuPinName) Judgment if the pin has sub clock function N/A void LcdComPin_Int(uint8_t) Base on hardware connect init the com pin N/A void LcdSegPin_Int(void) Base on hardware connect init segment pin N/A void LCD_Init(void) Init LCD controller N/A void LCD_Disable(void) Disable LCD function N/A void LcdDisp(void) Display the buffer data to LCD N/A void BT0ReloadTimer_Init(void) Init BT0 as reload timer, 1ms N/A void BT0Timer_Halt(void) Stop the BT0 as timer N/A void BT0Timer_Resume(void) Resume the BT0 as timer N/A void Eint_Init(McuPinName, uint8_t ) Init extern interrupt N/A void Eint_Disable(McuPinName) Disable appointed extern interrupt N/A void Lvd_Init(void) LVD initialization, if fall to 4V, LVD interrupt N/A 6.2 Function Prototype 6.2.1 Gpio_Init (McuPinName, uint8_t, uint8_t) Prototype void Gpio_Init (McuPinName WhichPin, uint8_t Dir, uint8_t Level) Parameter: Return WhichPin: The GPIO pin Dir: 1 -- output 0 -- input Level: When output: 0 -- low level 1 -- high level 2 -- high level and Hi-Z When input: 0 -- not connect pull-up resistor 1 -- connect pull-up resistor void Description Set a GPIO pin as input or output Remark N/A MCU-UM-510107-E-11 – Page 19 Bluemoon-EVB Firmware V1.1.0 Chapter 6 Driver Function 6.2.2 uint8_t GpioInputCheck(McuPinName, uint8_t) Prototype uint8_t GpioInputCheck (McuPinName WhichPin, uint8_t TouchValueVolt) Parameter: Return WhichPin: The GPIO pin TouchValueVolt: When Key touching, the voltage value uint8_t: 1 -- has a touch other -- has not a touch Description When a pin used as GPIO input, check if a key Remark N/A 6.2.3 uint8_t MultiAdcFun(McuPinName) Prototype uint8_t MultiAdcFun(McuPinName WhichPin) Parameter: WhichPin: The GPIO pin Return uint8_t: 1 -- yes other -- not Description Judgment if the pin has ADC function Remark N/A 6.2.4 uint8_t MultiLcdFun (McuPinName) Prototype uint8_t MultiLcdFun(McuPinName WhichPin) Parameter: WhichPin: The GPIO pin Return uint8_t: 1 -- yes other -- not Description Judgment if the pin has LCD function Remark N/A 6.2.5 uint8_t MultiMainClockFun(McuPinName) Prototype uint8_t MultiMainClockFun(McuPinName WhichPin) Parameter: WhichPin: The GPIO pin Return uint8_t: 1 -- yes other -- not Description Judgment if the pin has Main clock function Remark N/A MCU-UM-510107-E-11 – Page 20 Bluemoon-EVB Firmware V1.1.0 Chapter 6 Driver Function 6.2.6 uint8_t MultiSubClockFun(McuPinName) Prototype uint8_t MultiSubClockFun(McuPinName WhichPin) Parameter: WhichPin: The GPIO pin Return uint8_t: 1 -- yes other -- not Description Judgment if the pin has sub clock function Remark N/A 6.2.7 LcdComPin_Init (uint8_t) Prototype void LcdComPin_Init(uint8_t mode) Parameter: mode: LCD mode select 8 -- 8 com Return void Description Base on Hardware connect init the com pin Remark N/A 4 -- 4 com 6.2.8 LcdSegPin_Init () Prototype void LcdSegPin_Init(void) Parameter: void Return void Description Base on Hardware connect init the segment pin Remark N/A 6.2.9 LCD_Init() Prototype void LCD_Init(void) Parameter: void Return void Description Init LCD controller Remark N/A MCU-UM-510107-E-11 – Page 21 other value is invalid Bluemoon-EVB Firmware V1.1.0 Chapter 6 Driver Function 6.2.10 LCD_Disable () Prototype void LCD_Disable(void) Parameter: void Return void Description Disable LCD function Remark N/A 6.2.11 LcdDisp() Prototype void LcdDisp(void) Parameter: void Return void Description Display the buffer data to LCD Remark N/A 6.2.12 BT0ReloadTimer_Init() Prototype void BT0ReloadTimer_Init(void) Parameter: void Return void Description Init BT0 as reload timer, 1ms Remark N/A 6.2.13 BT0Timer_Halt() Prototype void BT0Timer_Halt(void) Parameter: void Return void Description Stop the BT0 as timer Remark N/A MCU-UM-510107-E-11 – Page 22 Bluemoon-EVB Firmware V1.1.0 Chapter 6 Driver Function 6.2.14 BT0Timer_Resume() Prototype void BT0Timer_Resume(void) Parameter: void Return void Description Resume the BT0 as timer Remark N/A 6.2.15 Eint_Init(McuPinName, uint8_t) Prototype void Eint_Init(McuPinName WhichPin, uint8_t trigger) Parameter: McuPinName: The MCU pin Trigger: 0 -- Low level detect 1-- High level detect 2 -- Rising edge detect 3 -- Falling edge detect Return void Description Init extern interrupt Remark N/A 6.2.16 Eint_Disable(McuPinName) Prototype void Eint_Disable(McuPinName WhichPin) Parameter: McuPinName: The MCU pin Return void Description Disable appointed extern interrupt Remark N/A 6.2.17 Lvd_Init() Prototype void Lvd_Init(void) Parameter: void Return void Description LVD initialization, detected voltage fall 4V, LVD interrupt Remark N/A MCU-UM-510107-E-11 – Page 23 Bluemoon-EVB Firmware V1.1.0 Chapter 7 Interrupt Function 7 Interrupt Function Note: More information about RTC, refer to FUJITSU MCU-AN-510045-E-10.pdf. 7.1 Function List Prototype Description Remark void BT_IRQHandler(void) BT0 interrupt, 1ms per N/A void INT0_7_Handler(void) Extern interrupt N/A void LVD_Handler(void) Low power detection interrupt N/A 7.2 Function Prototype 7.2.1 BT_IRQHandler() Prototype void BT_IRQHandler(void) Description BT0 interrupt, 1ms per Content BaseTimeCnt: Base timer counter, 1ms unit KeyDownCnt: Key touch counter, 1ms unit TouchModeCnt: Touch display mode counter, 1ms unit LcdBlinkCnt: LCD blink counter, 1ms unit LcdBlinkTimeCnt: LCD blink counter, used timer TscScanfCnt: TSC key scan time counter, 1ms unit PowerSupplyCnt: Judgment power voltage change timer N/A Remark 7.2.2 INT07_7_Handler() Prototype void INT0_7_Handler(void) Description Extern interrupt Content N/A Remark Used wake up MCU from low power consumption mode 7.2.3 LVD_Handler() Prototype void LVD_Handler(void) Description Low power detection interrupt Content PowerSupply: 0 -- 3.3V power Remark N/A 1 -- 5V power MCU-UM-510107-E-11 – Page 24 Bluemoon-EVB Firmware V1.1.0 Chapter 8 Demo System 8 Demo System 8.1 System Introduction This sample project is designed to quick start evaluation of 8-COM segment LCD, enter & exit low power consumption modes and setting of RTC based on MB9AA30N series MCU. There are 3 different system modes, include normal mode, test mode and standby RTC display mode (low power consumption). Additionally, LEDs are used to indicate the MCU running status. 8.2 System Features MCU LCD controller driver RTC setting and calibration Enter and exit low power consumption Mechanical key and joystick driver TSC key base on TSC_Lib LVD used to control LCD display parameter MCU-UM-510107-E-11 – Page 25 Bluemoon-EVB Firmware V1.1.0 Chapter 8 Demo System 8.3 System Firmware Design After power on, LCD displays “FUJITSU” lasts 3 s, runs normal mode and displays current time. Then press the key to enter other display modes. Normal mode Includes display current time and date, RTC setting and so on Test mode Include key and LED indication, enter and exit standby RTC mode in test mode Standby RTC mode (Low power consumption mode) Wake up and enter function Refer to chapter 6 of MCU-UM-510106-E-11- Bluemoon-EVB_HW. 8.3.1 User Interface J3 DC Power DB9 P1 U6 USB Power J2 LCD FSDC-FM3-A30-1-0024-01 (PCB)Bluemoon-EVB-V1.0.0 D4 Power Led J6 J7 J8 JTAG J4 J1 D2 Work Led SW1 Reset Key SW3 SW2 K1 Key TSC Key J5 Figure 8-1: Demo System User Interface Block Diagram MCU-UM-510107-E-11 – Page 26 Joystick Bluemoon-EVB Firmware V1.1.0 Chapter 8 Demo System 8.3.2 System Main Loop Start SystemInit LED indicates KeyScanf TSCKeyScanf LcdDisplay Low power mode Test mode KeyScanf Normal mode Enter low power Wake up? Mode? N Exit test mode? Y Y N Low power? N Y Enter low power Wake up? N Baseline update RTC calibration time? N Y RTC calibration Power change? N Y LCD init Figure 8-2: Demo System Main Loop Flowchart MCU-UM-510107-E-11 – Page 27 Y Bluemoon-EVB Firmware V1.1.0 Chapter 8 Demo System 8.3.3 System Files In this application, there are 15 files: common.c, common_device.c, lcd.c, lcd_device.c, TSC_ConfigInfo.c, adc12.c, isp.c, lpcm.c, lvd.c, rtc.c, calibration.c, lcd&rtc_serve.c, main.c, system_mb9afa3x.c, startup_mb9afa3x.s main.c, includes main loop and MCU control functions. common.c & common_device.c, includes initialization of key, joystick, led and so on. lcd.c & lcd_device.c, includes initialization of LCD. TSC_ConfigInfo.c, includes TSC configuration information. adc12.c, includes initialization ADC function. Isp.c, includes LVD, timer, external interrupt. lpcm.c, includes relation function about low power consumption. lvd.c, includes relation function about low power detection rtc.c, includes relation function about RTC. calibration.c, includes RTC calibration. lcd&rtc_serve.c, includes difference system modes and so on. system_mb9afa3x.c, includes initialization or update MCU clock. startup_mb9afa3x.s, MCU start-up codes. MCU-UM-510107-E-11 – Page 28 Bluemoon-EVB Firmware V1.1.0 Chapter 8 Demo System 8.3.4 System Files Structure Figure 8-3: Sample Project Files Structure MCU-UM-510107-E-11 – Page 29 Bluemoon-EVB Firmware V1.1.0 Chapter 9 Additional Information 9 Additional Information For more Information on FUJITSU semiconductor products, visit the following websites: English version address: http://www.fujitsu.com/cn/fsp/services/mcu/32bit/fm3/an.html Chinese version address: http://www.fujitsu.com/cn/fss/services/mcu/32bit/fm3/an.html MCU-UM-510107-E-11 – Page 30 Bluemoon-EVB Firmware V1.1.0 Chapter 10 Appendix 10 Appendix 10.1 List of Figures and Tables Table 3-1: MCU Development Environment ........................................................................... 8 Figure 8-1: Demo System User Interface Block Diagram ..................................................... 26 Figure 8-2: Demo System Main Loop Flowchart................................................................... 27 Figure 8-3: Sample Project Files Structure ........................................................................... 29 MCU-UM-510107-E-11 – Page 31