944KB

The following document contains information on Cypress products.
Colophon
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 any use that includes 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 any use where
chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable
to 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. If any products described in this document
represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law
of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the
respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion
product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without
notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy,
completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other
warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of
the information in this document.
®
®
®
TM
Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse ,
TM
ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and
other countries. Other names used are for informational purposes only and may be trademarks of their respective owners.
Fujitsu Semiconductor (Shanghai) Co., Ltd.
Setup Guide
MCU-AN-500072-E-13
F²MC-8FX FAMILY
8-BIT MICROCONTROLLER
MB95310/370 SERIES
EV BOARD MB2146-450-E
SETUP GUIDE
EV BOARD MB2146-450-E V1.3
Revision History
Revision History
Version
Date
Updated by
Modifications
1.0.
2009-8-27
Jane Li
First draft
1.1.
2009-12-30
Jane Li
Add FW user manual
1.2
2010-04-07
Jane Li
Add UART mode Baud rate 9600 descriptions.
1.3
2011-03-25
Jane Li
Delete the remark about EV-Board comes with BGMA
This manual contains 40 pages.
1. The products described in this manual and the specifications thereof may be changed without prior notice.
To obtain up-to-date information and/or specifications, contact your Fujitsu sales representative or Fujitsu
authorized dealer.
2. Fujitsu will not be liable for infringement of copyright, industrial property right, or other rights of a third party
caused by the use of information or drawings described in this manual.
3. The contents of this manual may not be transferred or copied without the express permission of Fujitsu.
4. The products contained in this document are not intended for use with equipment which require extremely
high reliability such as aerospace equipment, undersea repeaters, nuclear control systems or medical
equipment for life support.
5. Some of the products described in this manual may be strategic materials (or special technology) as defined
by the Foreign Exchange and Foreign Trade Control Law. In such cases, the products or portions theory
must not be exported without permission as defined under the law.
© 2009 Fujitsu Semiconductor (Shanghai) Co., Ltd.
MCU-AN-500072-E-13 – Page 2
EV BOARD MB2146-450-E V1.3
Contents
CONTENTS
REVISION HISTORY .............................................................................................................. 2 CONTENTS ............................................................................................................................ 3 1 PRODUCT OVERVIEW ..................................................................................................... 5 1.1 Objective and Deliverable ......................................................................................... 5 1.2 System Block ............................................................................................................ 5 1.3 Handling Precautions ................................................................................................ 5 1.4 Feature ...................................................................................................................... 6 1.5 Hardware Setup ........................................................................................................ 6 2 BGMA MANUAL ................................................................................................................ 7 2.1 BGMA Overview........................................................................................................ 7 2.2 Function List .............................................................................................................. 7 2.3 IDC10 Interface Description ...................................................................................... 8 2.4 BGMA USB Configuration ......................................................................................... 8 2.5 LED Description ...................................................................................................... 11 3 EV-BOARD MANUAL...................................................................................................... 12 3.1 EV-board Overview ................................................................................................. 12 3.2 Function List ............................................................................................................ 13 3.3 EV-board Schematic ............................................................................................... 14 3.4 HW Module Description and Jumper settings ......................................................... 15 3.4.1 Pin Assignment of MB95F310 ................................................................... 15 3.4.2 Power Module ........................................................................................... 16 3.4.3 I2C Module ................................................................................................ 18 3.4.4 A/D Module ............................................................................................... 18 3.4.5 LCD Module .............................................................................................. 20 3.5 Operation Manual.................................................................................................... 21 3.5.1 Mode Switch.............................................................................................. 21 3.5.2 EEPROM Sub-address Switch and EDIT ................................................. 22 3.5.3 Factory Mode ............................................................................................ 24 3.5.4 Temperature Operation ............................................................................. 24 3.5.5 UART Send ............................................................................................... 25 3.5.6 RTC Operation .......................................................................................... 26 3.5.7 Wake-Up Operation .................................................................................. 28 3.5.8 Reset Operation ........................................................................................ 29 3.5.9 Factory Operation ..................................................................................... 29 MCU-AN-500072-E-13 – Page 3
EV BOARD MB2146-450-E V1.3
Contents
3.5.10 Test Pin ..................................................................................................... 29 3.5.11 Battery Usage ........................................................................................... 29 4 SAMPLE CODE MANUAL .............................................................................................. 30 4.1 Project Structure ..................................................................................................... 30 4.2 Source Code File Description ................................................................................. 31 4.2.1 ADC .c ....................................................................................................... 31 4.2.2 Beep .c ...................................................................................................... 32 4.2.3 EEPROM .c ............................................................................................... 32 4.2.4 Ext-interrupt .c ........................................................................................... 32 4.2.5 I2C .c ......................................................................................................... 33 4.2.6 LCD .c ....................................................................................................... 33 4.2.7 RTC .c ....................................................................................................... 34 4.2.8 UART .c..................................................................................................... 35 4.2.9 delay_try Function ..................................................................................... 35 4.3 Global Variable Description..................................................................................... 36 4.4 How to Add These Files .......................................................................................... 37 4.5 Usage Demo ........................................................................................................... 37 5 DEVELOPMENT PLATFORM QUICK START ............................................................... 38 5.1 Tools Setup Sequence ............................................................................................ 38 5.2 Open Project and Start Debug ................................................................................ 38 5.3 Operation Precautions ............................................................................................ 38 6 ADDITIONAL INFORMATION ......................................................................................... 39 7 APPENDIX ....................................................................................................................... 40 7.1 Tables ..................................................................................................................... 40 7.2 Figures .................................................................................................................... 40 MCU-AN-500072-E-13 – Page 4
EV BOARD MB2146-450-E V1.3
Chapter 1 Product Overview
1
Product Overview
This product is a set of EV-Board of MB95F310 series. It is composed of a BGMA (MB214608-E) and an EV-board (MB2146-450-E). Combining the SOFTUNE Workbench on PC, the
EV-Board enables the quick start of development before the user system is ready.
1.1
Objective and Deliverable
The EV-Board provides users a complete development platform. Before starting using the
EV-Board, please make sure that the following devices are placed in the package:
9
EV-board (MB2146-450-E)
1PCS;
9
Hardcopies (China RoHS Report, Quick Start Guide )
2PCS
1.2
System Block
To set up a debugging system, first connect a PC, a BGMA and an EV-board together
according to Figure 1-1.
Easy design and study
MB95F310
MCU
with
BGMA and SOFTUNE
Sample code
Host PC
SOFTUNE
BGMA
MB95F310 MCU
USB
IDE
EV- Board
Figure 1-1: System Block
1.3
Handling Precautions
The EV-Board can be used in connection with its bundled products. To ensure use this
product correctly in a proper environment, please observe the following guideline:
z
Follow the instructions described in each manual for the bundled product to use this
product.
MCU-AN-500072-E-13 – Page 5
EV BOARD MB2146-450-E V1.3
Chapter 1 Product Overview
1.4
Feature
The MB95F310 Series EV-Board is the best for a performance and functional evaluation,
and operation check before using MB95F310 Series MCU in a user's system.
The features of the BGM debugger for MB95F310 Series MCU are shown as below.
z
z
z
z
z
1.5
Microcomputer operation voltage ranging from +1.8V to +3.3V.
Compact development environment, a light and small BGM Adapter.
Since a monitor program is performed in a separate memory space, it does not
consume any user memory space.
Continuous execution, step execution and break correspondence.
It connects with a host computer by the USB interface.
Hardware Setup
In the hardware setup procedure, you should configure and connect the hardware products.
This chapter introduces the configuring and connecting procedure for each product. Check
the contents and complete the hardware setup.
z
Configuration of each product
- Configuring EV-Board
z
Connection of each product
- Connecting BGMA and EV-board
- Connecting EV-Board power supply
MCU-AN-500072-E-13 – Page 6
EV BOARD MB2146-450-E V1.3
Chapter 2 BGMA Manual
2 BGMA Manual
This chapter gives introduction on how to set up BGMA.
2.1
BGMA Overview
Following is a close shot of a MB95200 Series BGMA. The Part Number is MB2146-08-E. It
provides a debug platform for the MB95F310 Series MCU with a small size of 55.7mm (W)
X127mm (D) X30mm (H).
Figure 2-1: BGMA Overview
2.2
ID
Function List
Function description
Remarks
MCU MAX machine clock: 16.25 MHz
1
Support MB95F310 Series MCU
2
Break pointer
256 software breakpoints
3
USB interface to PC/SOFTUNE
Compatible to USB protocol version 1.1
4
1-Line UART interface
MB95F310 Series MCU
5
Support the MCU flash programming The programming and reading speed is about
for engineering development
800 B/S.
to
MCU power supply voltage: 1.8*1*2 V ~ 3.3*1 V
the
The Baud rate is 62,500 bps.
*1: The value varies with the operating frequency, the machine clock or the analog
guaranteed range.
*2: The value is 1.9V when the low-voltage detection resetting is used.
*3: The threshold voltage can be set as 1.9, 2.35, 2.85V by software.
MCU-AN-500072-E-13 – Page 7
EV BOARD MB2146-450-E V1.3
Chapter 2 BGMA Manual
2.3
IDC10 Interface Description
Pin Number
2.4
Pin Name
Description
1
UVCC
Target MCU Vcc
2
GND
Target MCU Vss
3
RSTIN
Target MCU reset input
4
RSTOUT
Target MCU reset output
5
RSV
Reserved
6
RSV
Reserved
7
RSV
Reserved
8
DBG
Target MCU debug pin
9
RSV
Reserved
10
RSV
Reserved
BGMA USB Configuration
The BGMA is provided with a USB cable. Connect the BGMA to a PC with a USB cable. If
the connection is right, the following window will pop up. Follow the instructions displayed,
and then click Next.
Figure 2-2: Install BGMA in Windows (1)
MCU-AN-500072-E-13 – Page 8
EV BOARD MB2146-450-E V1.3
Chapter 2 BGMA Manual
Select Install from a list or specific location (Advanced), then click Next.
Figure 2-3: Install BGMA in Windows (2)
Select …\Drivers from the folder where SOFTUNE is installed, click Next.
Figure 2-4: Install BGMA in Windows (3)
MCU-AN-500072-E-13 – Page 9
EV BOARD MB2146-450-E V1.3
Chapter 2 BGMA Manual
Select BGMA (MB2146-08) from the window displayed in Figure 2-5, and then click Next.
Figure 2-5: Install BGMA in Windows (4)
Windows will install the driver automatically. Click Finish after the driver has completed the
installation normally. Then users can find the BGMA is recognized as MB2146-08 in
Windows system.
Figure 2-6: BGMA is installed in Windows
MCU-AN-500072-E-13 – Page 10
EV BOARD MB2146-450-E V1.3
Chapter 2 BGMA Manual
2.5
LED Description
First, when USB cable is plugged to PC, check whether the Power LED turns green or not.
Refer to Figure 2-7.
Figure 2-7: BGMA Power LED (1)
Second, plug IDC10 cable to the EV-board (target MCU board), then turn on EV-board. After
that, check whether the Power LED on the BGMA turns orange or not. Refer to Figure 2-8.
Orange
5V Power
through
IDC
Cable
Figure 2-8: BGMA Power LED (2)
MCU-AN-500072-E-13 – Page 11
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3 EV-board Manual
This chapter gives introduction on how to set up EV-board and functions of EV-Board.
3.1
EV-board Overview
MB95F310 EV-board is an evaluation platform for the MB95F310 Family microcontroller.
Figure 3-1 is a close shot of EV-board.
LCD circuit
Power circuit
Temperature
circuit
MCU
LCD voltage
divider circuit
KEY circuit
Test Pin
Beep circuit
UART circuit
EEPROM
circuit
DEBUG
circuit
Figure 3-1: EV-board Overview
MCU-AN-500072-E-13 – Page 12
LED circuit
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.2
Function List
The EV-board is consisted of a board and a sample firmware. The board, together with a
BGMA (PN: MB2146-08-E) and a SOFTUNE, provides a useful platform for using the MCU
and its peripherals. It features in the following functions.
9
Support LCD, can display five letters and six numbers
9
Support I2C, can write/read data to/from EEPROM
9
Support UART, can send and receive data asynchronously
9
Support temperature detection, can detect temperature from -40℃ to 85℃
9
Support low power control, can set standby time
9
Support mode switch, mode switch “EEPROM -> temperature -> UART -> RTC ->
EEPROM….”
9
Support wake-up from standby mode
9
Support beep, when a key is pressed, the beep makes a short sound
MCU-AN-500072-E-13 – Page 13
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.3
EV-board Schematic
Figure 3-2: EV-board Schematic
MCU-AN-500072-E-13 – Page 14
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.4
HW Module Description and Jumper settings
3.4.1 Pin Assignment of MB95F310
Table 3- 1 describes the assignment of MCU Pin
Table 3-1: Assignment of Pin
Pin name
P16
P15
P14
P13
P12
P11
P10
P24
P23
X0
X1
X1A
X0A
/RST
V0
V1
V2
V3
PA0
PA1
PA2
PA3
PB0 to PE7
P02
P01
P00
Pin Usage Description
PPG1
STB
LED3
LED4
DBG
UO0
UI0
SDA
SCL
external main clock
external main clock
external Sub-clock
external Sub-clock
reset Pin
LCD voltage divider
LCD voltage divider
LCD voltage divider
LCD voltage divider
COM0
COM1
COM2
COM3
SEG00 to SEG31
external interrupt
temperature AD
AD key
MCU-AN-500072-E-13 – Page 15
Logical Description
Low drive beep
Low drive LED
Low drive LED3
Low drive LED4
---------Low reset
Link to GND
Divider voltage 1.1V
Divider voltage 2.2V
Divider voltage 3.3V
-----Low drive interrupt
AD value from 0 to 0xff
No key AD value is 0xff
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.4.2 Power Module
EV-board provides 2 kinds of power supplies for user to choose. Please read the following
instructions before using.
9
DC Adaptor: 5V DC:
Output voltage: 3.3V
Connection: Connector (J12)
9
Battery:
QTY: 4PCS;
Model: AA;
Nominal voltage: 1.5V.
Connection: Socket for Battery
If any of the power supplies is connected to the EV-board correctly, power LED (D5) on the
EV-board will be on. Refer to Figure 3-3.
Figure 3-3: Power Module
The following two power supplies are recommended. Please follow the settings below.
Table 3-2: Selection of Power Supply
Power supply
Header name
Settings
5V
4 AA batteries from
BT1 on the back of U5: BAT.
the EV-board.
MCU-AN-500072-E-13 – Page 16
U5
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
5V
5V DC from J12
U5: 5V.
MCU-AN-500072-E-13 – Page 17
U5
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.4.3 I2C Module
There are two switches between at24c08 and EEPROM. When I2C is used to visit EEPROM,
they will switch off. When I2C is used to visit external chip, they will switch on. Following
settings is recommended:
Table 3-3: I2C Switch
Modules
Header name
Settings
SW1
EEPROM
SW1: on.
SW2: on
SW2
SW1
External chip
SW1: off.
SW2: off
SW2
3.4.4 A/D Module
Key module and temperature module use the ADC to detect the real-time operation and
environment temperature.
For key module, please refer to Figure 3-4.
Wake Up
CONFIRM
Mode
SEND
User
RIGHT
Left
UP
Down
Figure 3-4: Key Module
MCU-AN-500072-E-13 – Page 18
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
Table 3-4 describes the function of keys.
Table 3-4: KEY Description
KEY
FUNCTION
MODE
Switch mode:”EEPROM -> Temperature
-> UART -> RTC -> EEPROM….”
CONFIRM
Confirm some operations to enter into
edit mode or confirm edit result
USER
Reserved for user
SEND
Send data by UART send function
LEFT
Move led position to left
RIGHT
Move led position to right
DOWN
Reduce value by 1 step or reduce
EEPROM sub-address by 1 step
UP
Add value by 1 step or add EEPROM
sub-address by 1 step
MCU-AN-500072-E-13 – Page 19
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.4.5 LCD Module
COM0~COM3 and SEG00 ~SEG31 are used to drive LCD. Table 3-5 describes the
relationship between SEG and LCD
Table 3-5: LCD Assignment
SEG(00…..31)
SEG00
SEG01
SEG02
SEG03
SEG04
SEG05
SEG06
SEG07
SEG08
SEG09
SEG10
SEG11
SEG12
SEG13
SEG14
SEG15
SEG16
SEG17
SEG18
SEG19
SEG20
SEG21
SEG22
SEG23
SEG24
SEG25
SEG26
SEG27
SEG28
SEG29
SEG30
SEG31
LED(0…10)
LED0
LED1
LED2
LED3
LED4
LED5
LED6
LED7
LED8
LED9
LED10
MCU-AN-500072-E-13 – Page 20
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5
Operation Manual
3.5.1 Mode Switch
Pressing mode key can switch EEPROM mode to RTC mode, following figures describe the
operation.
9
Default is EEPROM mode.
9
Pressing Mode key ---switch to temperature mode.
9
Pressing Mode key ---switch to UART mode.
9
Pressing Mode key ---switch to RTC mode.
MCU-AN-500072-E-13 – Page 21
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5.2 EEPROM Sub-address Switch and EDIT
In EEPROM mode, the LCD displays the value of a certain sub-address.
Status
Data
If you press Up or Down key, the value of sub-address will change.
When you want to change the value of this sub-address, please press Confirm key.
Pressing Left or Right to select a LED Æ Up or Down to change the value.
MCU-AN-500072-E-13 – Page 22
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
Press Confirm key to confirm this operation.
Note:
Status “0” ------ normal status
Status “1” ------ setting status
MCU-AN-500072-E-13 – Page 23
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5.3 Factory Mode
In EEPROM normal status, press Send and Wake-up key in turn, and system enters into
factory mode. In factory mode, all EEPROM data are initialized to its sub-address and the
LCD will display the value written into the sub-address.
3.5.4 Temperature Operation
When it is changed to the environment temperature mode, the LCD will display the current
temperature value which can be changed by 5℃ at each time.
MCU-AN-500072-E-13 – Page 24
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5.5 UART Send
Switch the mode to UART, the LCD will display the value of received data; if you want to
send data, the following operation will be an example.
9
Pressed Mode key ---switch to UART mode.
Status
Data
9
Press Confirm key to enter EDIT.
9
Press Left or Right to select a LED Æ Up or Down to change the value.
9
Press Send key to send out and return receiving status.
Note:
Status “0” ------ normal status
Status “1” ------ setting status
The baud rate of the EV-Board sample code is 9600.
MCU-AN-500072-E-13 – Page 25
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5.6 RTC Operation
When system is powered on, the RTC timer begins to count. When user wants to enter
standby mode, the sleep mode can be selected by setting the timer; after setting standby
time, counter counts continuously and enters sleep mode when the counter value is same as
the set value.
Following operation describes the standby time setting.
9
Press Mode key ---switch to RTC mode.
Status
Hour
Minute
Second
9
Press Confirm key to enter EDIT status.
9
Press Left or Right to select a LED Æ Up or Down to change the value. Set standby
time to 0 hour 4 minutes and 30 seconds.
9
Press Confirm key to confirm this setting.
MCU-AN-500072-E-13 – Page 26
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
Note:
1. When the time is set to 0 hour 0 minute and 0 second, the system will not enter
standby mode.
2. The setting time must be bigger than the system running time.
3. The maximum time that enters to enter standby mode is 9 hours 59 minutes and 59
seconds.
4. Status “0” ------normal status
Status “1”------ setting status
Status “2”------ waiting to enter standby mode
MCU-AN-500072-E-13 – Page 27
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5.7 Wake-Up Operation
There is a wake-up key on the LCD EV-Board, which uses external interrupt to wake up
system from sleep mode.
When system enters sleep mode, no operation can be made except the wake-up key.
The following operation describes the wake-up process.
9
When the timer is the same as standby setting time, system will enter sleep mode.
9
Press Wake-up key, system enters normal status; timer counts continuously.
MCU-AN-500072-E-13 – Page 28
EV BOARD MB2146-450-E V1.3
Chapter 3 EV-board Manual
3.5.8 Reset Operation
There is a reset key to be used when user wants to reset system. In normal condition, the
reset pin is connected to VCC. While reset key pressed, it is connected to GND.
3.5.9 Factory Operation
In EEPROM normal mode, press Send key and then press Wakeup key, and EEPROM
value will be initialized to its sub-address value.
3.5.10 Test Pin
For every pin of MB95F310, there is a test pin connected to it.
3.5.11 Battery Usage
The supply power is 3.3V for MCU EEPROM and MAX232. The LCD EV-Board uses power
chip AMS1117-3.3 to transfer input power from 5V to 3.3V, so the maximum number of
battery supply cannot be more than four cells (1.5V each cell).
MCU-AN-500072-E-13 – Page 29
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4 Sample Code Manual
4.1
Project Structure
There is a project LCD EV-Board Project.prj in this MB95F310 EV-Board.
The following structure describes the flow chart of this project, as shown in Figure 4-1.
Figure 4-1: Project Structure
The following sample codes are provided with MB95F310 Series EV-Board.
MCU-AN-500072-E-13 – Page 30
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.2
Source Code File Description
Eight drive files are available in this project shown below.
Figure 4-2: Source Code Files
4.2.1 ADC .c
In this function, environment temperature and key value will be calculated.
Following table describes the ADC library:
Function Name
Description
void ADC0_Init(void)
Initialize ADC function
void ADCTempSwitKey(void)
Detect keyboard value and temperature value
Following table describes how to use these functions.
Example
Type
Key Value Detect
Temperature Detect
Operation
ADC0_Init();
ADCTempSwitKey();
Return
Global variable PraGlo.KEYFuncValue saved the key
value
Global variable PraGlo.TempNum saved the
temperature value
MCU-AN-500072-E-13 – Page 31
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.2.2 Beep .c
When AD key is pressed, it will make a short beep sound by setting different values to PIN
PPG1.
Following table describes the Beep library:
Function Name
Description
void Beep_On(void)
beep sound out
void Beep_Off(void)
Off beep sound
4.2.3 EEPROM .c
In this function, all values of EEPROM are initialized to 0x80 and global parameters are
initialled to 0.
Following table describes the EEPROM library:
Function Name
void Init_EEProm(void)
Description
Initialize all global variables and EEPROM values to
their sub-address numbers
4.2.4 Ext-interrupt .c
In this function, external interrupt register are initialized.
Following table describes the external interrupt library:
Function Name
Description
void EXT_Init(void)
Initialize external interrupt
__interrupt void INTER_EXT (void)
Capture falling edge and generate interrupt
MCU-AN-500072-E-13 – Page 32
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.2.5 I2C .c
In this function, the user can initialize I2C status and use SCL and SDA to send data to
master device and receive data from slave device.
Following table describes the I2C library:
Function Name
Description
unsigned char RD_I2C( unsigned char Main_Addr,
unsigned char Sub_Addr )
Read data from Sub_Addr
void Write_I2C_Proc(unsigned char MainAddr,
unsigned char SubAddr, unsigned char I2Cdata)
Write data I2Cdata to SubAddr
Following table describes how to use these functions.
Example
Type
Operation
Return
Read data
RD_I2C(0xa0,0x01);
Read data from EEPROM sub-address 0x01
Write data to EEPROM
Write_I2C_Proc(0xa0,0x01,0x25);
Write 0x25 to EEPROM sub-address 0x01
4.2.6 LCD .c
In this function, the user can initialize LCD register and drive LCD by sending different data
to SEG00~SEG31.
Following table describes the LCD library:
Description
Function Name
void Init_LCD(void)
Initialize LCD module
void LCD_Clear(void)
Clear LCD display
void LCD_LigON_NUM(unsigned char Num, unsigned
char Dat)
Drive LCD Num to display number Dat
Following table describes how to use these functions.
Example
Type
Display LCD
Operation
LCD_LigON_NUM(0x02,0x06);
Return
Drive LED 2 to display number 6
MCU-AN-500072-E-13 – Page 33
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.2.7 RTC .c
In this function, the user can initialize clock register, start time base timer, set display value
for LCD and set condition to enter standby mode
Following table describes the LCD library:
Function Name
Description
void TBT_Init(void)
Initialize time base timer
__interrupt void TBT_Inter (void)
Time base timer interrupt for 0.35ms arrived
void STB_Mode_Set(void)
Set standby time
Following table describes how to use these functions.
Example
Type
Enable RTC
Operation
TBT_Init();
Return
Set interval time
TBT_Init();
Set standby time
PraBli.Bli_6 = 0x01;
PraBli.Bli_6 is hour,
PraBli.Bli_7 = 0x00;
PraBli.Bli_7 and PraBli.Bli_8 are minute,
PraBli.Bli_8 = 0x00;
PraBli.Bli_9 and PraBli.Bli_a are second.
PraBli.Bli_9 = 0x02;
In this example setting, after 1 hour 26
seconds, the system will stand by.
PraBli.Bli_a = 0x06;
STB_Mode_Set();
EXT_Init();
TBT_Init();
PraBli.Bli_6 = 0x01;
Standby and Wake up
PraBli.Bli_7 = 0x00;
PraBli.Bli_8 = 0x00;
Press Wake-up key, and the system wakes
up.
PraBli.Bli_9 = 0x02;
PraBli.Bli_a = 0x06;
STB_Mode_Set();
MCU-AN-500072-E-13 – Page 34
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.2.8 UART .c
In this function, the MCU works in an asynchronous mode. The baud rate is generated by a
dedicated baud rate generator. In the EV-Board sample code the baud rate is 9600.
Following table describes the LCD library:
Function Name
Description
void UART_init (void)
Initialize UART module
void UART_sendbyte (char ch)
Send data ch by UART
__interrupt void UART_REC_INTER(void)
Receive data by UART when data is arrived
Following table describes how to use these functions.
Example
Type
Operation
UART_init();
Send data
UART_sendbyte(0x55);
Receive data
Return
Send out data 0x55 by UART
Global variable PraGlo.Uart_Rec saved the
received data
UART_init();
4.2.9 delay_try Function
In this project, some instruction needs to be delayed, so the delay function must be defined
before using these C files. Following code is the delay_try function.
void delay_try(unsigned char Dat)
{
unsigned char i,j;
for(i=0;i<255;i++)
{
for(j=0;j<Dat;j++)
{
__wait_nop();
}
}
}
MCU-AN-500072-E-13 – Page 35
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.3
Global Variable Description
Five drive files are available in this project shown below,
9
_f2mc8fx.h
_f2mc8fx.h is system-defined document. Ignore it
9
mb95310.h
Mb95310.h is system-defined document. Ignore it
9
def.h
This file basically includes all global variables of FW
Following table describes the main struct.
9
Struct Name
Description
Global
Include global variable used between c files
RTCPar
Include global variable used in time base timer and standby
EepPra
Include global variable used in I2C module
BlinkPra
Include global variable used in six LEDs
Key.h
This file includes eight key names, which are “UP”, “DOWN”, “RIGHT”, “LEFT”, “SEND”,
“CONFIRM”, “MODE” and “USER”.
9
Proc.h
This file includes all functions which will be used in other functions.
MCU-AN-500072-E-13 – Page 36
EV BOARD MB2146-450-E V1.3
Chapter 4 Sample Code Manual
4.4
How to Add These Files
Before using chapter4.2 file, please refer to the following steps.
¾
Create a new project.
¾
Copy .c file to project document.
¾
Add .c file to project.
¾
Add all needed .c files to project.
4.5
Usage Demo
Following table is an example on how to use this C file. Process_Control() is a user-defined
function which transfers the C file of ADC when user wants to use ADC, the C file of I2C
when the user wants to use I2C, and the C file of RTC when the user wants to use RTC.
ADC0_Init();
// initialize ADC
UART_init();
// initialize UART
EXT_Init();
// initialize Interrupt
Init_LCD();
// initialize LCD
TBT_Init();
// initialize Timebase timer
Init_EEProm();
// initialize EEPROM
while(1)
{
ADCTempSwitKey();
// Judge key value
Process_Control();
// transfer every
library
LCD_LigON_NUM(0,2);
// display LCD
}
MCU-AN-500072-E-13 – Page 37
EV BOARD MB2146-450-E V1.3
Chapter 5 Development Platform Quick Start
5 Development Platform Quick Start
5.1
Tools Setup Sequence
Start the debugging system in the following sequence:
9
Connect a BGMA to the PC with a USB cable, confirm whether the LED on the BGMA is
green;
9
Connect an EV-board to BGMA IDC10 socket;
9
Select the EV-board power supply and turn on the EV-board, confirm whether the LED
on the BGMA is orange and the Power LED on the EV-board is on.
5.2
Open Project and Start Debug
Users can start a debug from a PC software SOFTUNE workbench in the following
sequence. Take SIMULATE LCD EVBOARD project as an example.
9
Start the SOFTUNE by selecting Programs> SOFTUNE V3> FFMC-8L Family
SOFTUNE Workbench from Start Menu;
9
Click Open workspace from File Menu in SOFTUNE;
9
Select SIMULATE LCD EVBOARD.wsp in Open Space window;
9
Click Start debug from Debug Menu.
If the entire procedure goes right, a debug will start normally.
5.3
Operation Precautions
9
All pins of MB95F310 Series MCU are connected to Testing Pin on the EV-board. If user
wants to test the performance of a single pin, please connect it to the test pin.
9
Note: before connecting with BGMA, do not power on system.
9
It’s recommended that only one power supply is used as a power module input at a time.
MCU-AN-500072-E-13 – Page 38
EV BOARD MB2146-450-E V1.3
Chapter 6 Additional Information
6 Additional Information
For more Information on FUJITSU Semiconductor products, visit the following websites:
English version address:
http://www.fujitsu.com/cn/fsp/services/mcu/mb95/application_notes.html
Chinese version address:
http://www.fujitsu.com/cn/fss/services/mcu/mb95/application_notes.html
MCU-AN-500072-E-13 – Page 39
EV BOARD MB2146-450-E V1.3
Chapter 7 Appendix
7 Appendix
7.1
Tables
Table 3-1: Assignment of Pin ................................................................................................. 15 Table 3-2: Selection of Power Supply .................................................................................... 16 Table 3-3: I2C Switch ............................................................................................................. 18 Table 3-4: KEY Description .................................................................................................... 19 Table 3-5: LCD Assignment ................................................................................................... 20 7.2
Figures
Figure 1-1: System Block ......................................................................................................... 5 Figure 2-1: BGMA Overview .................................................................................................... 7 Figure 2-2: Install BGMA in Windows (1) ................................................................................. 8 Figure 2-3: Install BGMA in Windows (2) ................................................................................. 9 Figure 2-4: Install BGMA in Windows (3) ................................................................................. 9 Figure 2-5: Install BGMA in Windows (4) ............................................................................... 10 Figure 2-6: BGMA is installed in Windows ............................................................................. 10 Figure 2-7: BGMA Power LED (1) ......................................................................................... 11 Figure 2-8: BGMA Power LED (2) ......................................................................................... 11 Figure 3-1: EV-board Overview ............................................................................................. 12 Figure 3-2: EV-board Schematic ............................................................................................ 14 Figure 3-3: Power Module ...................................................................................................... 16 Figure 3-4: Key Module .......................................................................................................... 18 Figure 4-1: Project Structure .................................................................................................. 30 Figure 4-2: Source Code Files ............................................................................................... 31 MCU-AN-500072-E-13 – Page 40