1MB

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.
Application Note
MCU-AN-500083-E-12
F²MC-8FX FAMILY
8-BIT MICROCONTROLLER
MB95350L SERIES
EV BOARD MB2146-460-E
APPLICATION NOTE
MB2146-460-E Setup Guide V1.2
Revision History
Revision History
Version
Date
Updated by
Modifications
1.0
2010-04-09
Jane Li
First draft
1.1
2011-03-15
Jane Li
Modified some remark
1.2
2011-03-25
Jane Li
Cancel remark that EVB comes with BGMA
This manual contains 53 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.
© 2010 Fujitsu Semiconductor (Shanghai) Co., Ltd.
MCU-AN-500083-E-12 – Page 2
MB2146-460-E Setup Guide V1.2
Contents
CONTENTS
REVISION HISTORY .............................................................................................................. 2 CONTENTS ............................................................................................................................ 3 1 PRODUCT OVERVIEW ..................................................................................................... 6 1.1 Objective and Deliverable ......................................................................................... 6 1.2 System Block ............................................................................................................ 6 1.3 Handling Precautions ................................................................................................ 6 1.4 Feature ...................................................................................................................... 7 1.5 Hardware Setup ........................................................................................................ 7 2 BGMA MANUAL ................................................................................................................ 8 2.1 BGMA Overview........................................................................................................ 8 2.2 Function List .............................................................................................................. 8 2.3 IDC10 Interface Description ...................................................................................... 9 2.4 BGMA USB Configuration ......................................................................................... 9 2.5 LED Description ...................................................................................................... 12 3 EV-BOARD MANUAL...................................................................................................... 13 3.1 EV-board Overview ................................................................................................. 13 3.2 Function List ............................................................................................................ 14 3.3 EV-board Schematic ............................................................................................... 15 3.4 HW Module Description and Jumper settings ......................................................... 16 3.4.1 Pin Assignment of MB95350L ................................................................... 16 3.4.2 Power Module ........................................................................................... 17 3.4.3 I2C Slave Module ...................................................................................... 18 3.4.4 I2C master Module .................................................................................... 18 3.4.5 A/D Module ............................................................................................... 19 3.4.6 LED Module .............................................................................................. 20 3.5 Operation Manual.................................................................................................... 21 3.5.1 Single Board Mode.................................................................................... 21 3.5.2 Series Connection Mode ........................................................................... 22 3.5.3 Net Connection Mode ............................................................................... 23 3.5.4 ADC module .............................................................................................. 24 3.5.5 Wake-Up Operation .................................................................................. 24 3.5.6 Reset Operation ........................................................................................ 25 3.5.7 Test Pin ..................................................................................................... 25 3.5.8 Battery Usage ........................................................................................... 25 MCU-AN-500083-E-12 – Page 3
MB2146-460-E Setup Guide V1.2
Contents
4 SAMPLE CODE MANUAL .............................................................................................. 26 4.1 Project Structure ..................................................................................................... 26 4.2 Source Code File Description ................................................................................. 27 4.2.1 ADC .c ....................................................................................................... 27 4.2.2 Addressjudge .c ........................................................................................ 28 4.2.3 Ext-interrupt .c ........................................................................................... 29 4.2.4 I2C .c ......................................................................................................... 30 4.2.5 Initial .c ...................................................................................................... 31 4.2.6 Slavemodei2c .c ........................................................................................ 32 4.2.7 Standby .c ................................................................................................. 33 4.2.8 Timer.c ...................................................................................................... 34 4.3 API Code File Description ....................................................................................... 35 4.3.1 I2CMasterMacro.c ..................................................................................... 35 4.3.2 I2CSlaveMacro.c ....................................................................................... 37 4.3.3 SleepMacro.c ............................................................................................ 38 4.4 Global Variable Description..................................................................................... 39 4.5 How to Add These Files .......................................................................................... 40 4.6 Usage Demo ........................................................................................................... 41 4.6.1 Code of main.c .......................................................................................... 41 4.6.2 Code of Initial_ADC ................................................................................... 41 4.6.3 Code of Read_ADC .................................................................................. 42 4.6.4 Code of Judge_SlaveAddr ........................................................................ 42 4.6.5 Code of Init_EXT ....................................................................................... 43 4.6.6 Code of INTER_EXT ................................................................................. 43 4.6.7 Code of I2C_Init ........................................................................................ 43 4.6.8 Code of Read_I2C .................................................................................... 44 4.6.9 Code of Write_I2C..................................................................................... 44 4.6.10 Code of Initial ............................................................................................ 44 4.6.11 Code of SlaveI2C_PrepareForInter ........................................................... 45 4.6.12 Code of INTER_I2CSlaveModeWakeUp .................................................. 46 4.6.13 Code of STBLED_ON ............................................................................... 47 4.6.14 Code of Write_StandBy............................................................................. 47 4.6.15 Code of Clock_Init ..................................................................................... 47 4.6.16 Code of Judge_P00 .................................................................................. 48 4.6.17 Code of LEDCoordin ................................................................................. 48 4.6.18 Code of EEPROM_I2C ............................................................................. 49 4.6.19 Code of EndDevice_I2C ............................................................................ 49 4.6.20 Code of I2C_MasterMacro ........................................................................ 50 MCU-AN-500083-E-12 – Page 4
MB2146-460-E Setup Guide V1.2
Contents
4.6.21 Code of I2C_SlaveMacro .......................................................................... 50 4.6.22 Code of Sleep_Macro ............................................................................... 50 5 DEVELOPMENT PLATFORM QUICK START ............................................................... 51 5.1 Tools Setup Sequence ............................................................................................ 51 5.2 Open Project and Start Debug ................................................................................ 51 5.3 Operation Precautions ............................................................................................ 51 6 ADDITIONAL INFORMATION ......................................................................................... 52 7 APPENDIX ....................................................................................................................... 53 7.1 Tables ..................................................................................................................... 53 7.2 Figures .................................................................................................................... 53 MCU-AN-500083-E-12 – Page 5
MB2146-460-E Setup Guide V1.2
Chapter 1 Product Overview
1
Product Overview
This product is a set of EV-Board of MB95350L series. It is composed of a BGMA (MB214608-E) and an EV-board (MB2146-460-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-460-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 Figure1-1.
Easy design and study
MB95350L
MCU
with
BGMA and SOFTUNE
Sample code
Host PC
SOFTUNE
BGMA
MB95350L 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 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-500083-E-12 – Page 6
MB2146-460-E Setup Guide V1.2
Chapter 1 Product Overview
1.4
Feature
The MB95350L Series EV-Board is the best for a performance and functional evaluation,
and operation check before using MB95350L Series MCU in a user's system.
The features of the BGM debugger for MB95350L 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 executed 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 section 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-500083-E-12 – Page 7
MB2146-460-E Setup Guide V1.2
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 MB95350L Series BGMA. The Part Number is MB2146-08-E. It
provides a debugging platform for the MB95350L 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 MB95350L 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 to the MB95350L
The Baud rate is 62,500 bps.
Series MCU
5
Support the MCU flash programming for
The programming and reading speed is about 800 B/S.
engineering development
MCU power supply voltage: 1.8*1*2*3 V ~ 3.3*1 V
*1: The value varies with the operating frequency, the machine clock or the analog
guaranteed range.
*2: The value is 2.03V when the low-voltage detection resetting is used.
*3: The threshold voltage can be set to 2.03 V, 2.55 V or 3.10 V by using the software.
MCU-AN-500083-E-12 – Page 8
MB2146-460-E Setup Guide V1.2
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-500083-E-12 – Page 9
MB2146-460-E Setup Guide V1.2
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-500083-E-12 – Page 10
MB2146-460-E Setup Guide V1.2
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-500083-E-12 – Page 11
MB2146-460-E Setup Guide V1.2
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-500083-E-12 – Page 12
MB2146-460-E Setup Guide V1.2
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
MB95350L EV-board is an evaluation platform for the MB95350L Family microcontroller.
Figure 3-1 is a close shot of EV-board.
Power circuit
BGMA
Circuit
LED circuit
MCU
Key circuit
Test pin
I2C slave circuit
I2C master circuit
Figure 3-1: EV-board Overview
MCU-AN-500083-E-12 – Page 13
ADC circuit
MB2146-460-E Setup Guide V1.2
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 I2C, can write/read data to/from EEPROM or other chips
9
Support I2C slave and I2C master
9
Support A/D conversion
9
Support standby mode and wake-up from I2C
MCU-AN-500083-E-12 – Page 14
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.3
EV-board Schematic
5
Figure 3-2: EV-board Schematic
MCU-AN-500083-E-12 – Page 15
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.4
HW Module Description and Jumper settings
3.4.1 Pin Assignment of MB95350L
Table 3-1 describes the assignment of MCU Pin
Table 3-1: Assignment of Pin
Pin name
X0
X1
VSS
X1A
X0A
VCC
PG0
/RST
SCL1
SDA1
P62
P63
SCL0
SDA0
P64
P00
P01
P02
P03
P04
P05
P06
P07
DBG
Pin Usage Description
External main clock
External main clock
GND
External sub-clock
External sub-clock
VCC
General-purpose I/O port
RESET
SCL1
SDA1
General-purpose I/O port
General-purpose I/O port
SCL0
SDA0
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
General-purpose I/O port
LED7
LED2
LED1
DEBUG
MCU-AN-500083-E-12 – Page 16
Logical Description
--------------EEPROM connect detect
ADC input
---“Send” key
“low” light on
“low” light on
“low” light on
--
MB2146-460-E Setup Guide V1.2
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 (J1)
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 LED6 on the EVboard 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 the EVboard.
BAT.
5V
5V DC from J1
5V.
MCU-AN-500083-E-12 – Page 17
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.4.3
.4.3 I2C Slave Module
The I2C slave is used to connect external master SDA and SCL. There are two channels in
I2C slave module. The in channel is used for the board to receive slave information and the
out channel transfers the same SDA and SCL information to another board.
Out channel
In channel
Figure 3-4: I2C Slave In
3.4.4 I2C master Module
There is a switcher near AT24C04. When I2C is used to visit AT24C04, the switcher should
be set to the up side (IIC). When I2C is used to visit external chip, the switcher should be set
to the down side (GND).
Figure 3-5: I2C Switch
MCU-AN-500083-E-12 – Page 18
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.4.5 A/D Module
Use A/D value to set address.
Slave device1
Slave device2
Slave device3
Slave device4
Slave device5
3
2
4
Orientation
5
1
Figure 3-6: ADC Module
Note: The orientation to which the section faced will decide the slave device
MCU-AN-500083-E-12 – Page 19
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.4.6
.4.6 LED Module
Three LEDs are connected to P07, P06 and P05, for showing the states.
Sleep mode
Device
selected
Cooperate successful
Figure 3-7: LED Assignment
MCU-AN-500083-E-12 – Page 20
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.5
Operation Manual
3.5.1 Single Board Mode
Figure 3-8: Single Mode
When you get one board, the board works singly as follows:
z
When it is started (power on or reset), the I2C0 works as I2C master, and its subaddress is determined by the ADC.
z
If Send key is pressed, the I2C0 will write the ADC data to AT24C04, and then read
from it.
z
If the read data is same as the ADC data, LED2 will light on, or else it will be off.
z
After that, system will enter sleep mode.
Note: The master jumper setting please refer to section 3.4.4
MCU-AN-500083-E-12 – Page 21
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.5.2
.5.2 Series Connection Mode
In
Out
GND
Out
Up
board
Main
board
In
Down
board
Figure 3-9: Series Mode
In series connection mode, main board and down board work as master and slave
simultaneously, while up board only works as master.
z
After the Send key on up board is pressed, the ADC value is sent to main board.
z
The Main board judges whether its address matches with the first data sent by up
board.
z
If the received address matches with the address of main board, the main board
sends ACK to up board.
z
Up board enters into sleep mode.
z
Main board saves the data received from up board.
z
When the Send key on main board is pressed, main board sends the saved data to
down board.
z
Down board judges whether its address matches with the address sent by main board.
z
If down board address match with its’ received address, down board sends ACK to
main board.
z
Main board enters into sleep mode.
z
Down board saves the received data.
z
When the Send key on down board is pressed, down board sends the saved data to
EEPROM.
z
Down board enters into sleep mode.
Note: for the master jumper setting please refer following:
Up board ---------- GND
Main board --------GND
Down board ------- IIC
MCU-AN-500083-E-12 – Page 22
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.5.3
.5.3 Net Connection Mode
Main
board
Potentiometer
Out
In
In
GND
Slave
board1
Slave
board2
Figure 3-10: Net Mode
In net connection mode, one board is the master board and the other boards are the slave
boards.
z
Press Send key of master board, and the slave board whose potentiometer grade is
same as that of master potentiometer will receive the data sent by master board.
z
Turn the potentiometer to select different slave boards.
z
Main board will enter into sleep after operation.
z
After receiving data from master board, the slave board will save the data.
z
When the Send key on slave board is pressed, the saved data will be written and
then read to/from its EEPROM.
z
If the read data is same as the saved data, the LED (D2) will light on, or else the LED
will be off.
z
After operation, slave board will enter into sleep mode.
Note: for the master jumper setting please refer following:
Main board ---------- GND
Slave board1 --------IIC
Slave board2 -------- IIC
MCU-AN-500083-E-12 – Page 23
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.5.4 ADC module
The potentiometer is divided into 5 grades, and each grade corresponds to one slave board
address. The slave address is divided into 0x10, 0x20, 0x30, 0x40 and 0x50. Details are as
follow.
Figure 3-11: Potentiometer Grade
3.5.5 Wake-Up Operation
After normal operation, system will enter into sleep mode, and will be waked up by resetting,
press send key, or I2C information.
9
When system enter into sleep mode, the LED1 will light on
9
After system wakes up, the LED1 will be off.
MCU-AN-500083-E-12 – Page 24
MB2146-460-E Setup Guide V1.2
Chapter 3 EV-board Manual
3.5.6 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. The reset key is connected to GND when being pressed.
3.5.7 Test Pin
There is a test pin connected to each pin of MB95350L.
3.5.8 Battery Usage
The supply power is 3.3V for MCU EEPROM and potentiometer. The EV-Board uses power
chip AMS1117-3.3 to transfer input power from 5V to 3.3V. And the maximum number of
battery supply is four cells (1.5V each cell). U2 is a switch to transfer between battery and
power supply. For detail please refer to Figure 3-12.
Figure 3-12: Battery Selecting
MCU-AN-500083-E-12 – Page 25
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4 Sample Code Manual
4.1
Project Structure
There is a project in this MB95350L EV-Board.
The following structure describes the flow chart of this project, as shown in Figure 4-1.
Figure 4-1: Project Structure
MCU-AN-500083-E-12 – Page 26
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
The following sample codes are provided by MB95350L Series EV-Board.
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
Following table describes the ADC library.
Function Name
Description
void ADC0_Init(void)
Initialize ADC function
unsigned char Read_ADC(void)
Read and return ADC value
Following table describes the function ADC0_Init.
Function name
ADC0_Init
Function prototype
void ADC0_Init(void)
Behavior description
Initializes A/D module
Input parameter
None
Return value
None
Example
Sets ADC input channel is AN00, and disable interrupt:
ADC0_Init();
Following table describes the function Read_ADC.
Function name
Read_ADC
Function prototype
unsigned char Read_ADC(void)
Behavior description
Read the ADC result
Input parameter
None
Return value
Return ADC result
Example
[variavle] = Read_ADC();
MCU-AN-500083-E-12 – Page 27
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.2.2 Addressjudge .c
Following table describes the Addressjudge library:
Function Name
Description
unsigned char Judge_SlaveAddr(unsigned char
AddrJudg)
Divide ADC value into five constants
When IIC0 is connected to multiple slave devices, these five constants are used decide
which one to access.
Following table describes the function Addressjudge.
Function name
Judge_SlaveAddr
Function prototype
unsigned char Judge_SlaveAddr(unsigned char AddrJudg)
Behavior description
Divide the ADC value to 5 areas: 0x10,0x20,0x30,0x40,0x50
Input parameter
ADC value
Return value
Area number
Example
Judge ADC value 0x36 is belong to which area:
[variable] = Judge_SlaveAddr(0x36);
MCU-AN-500083-E-12 – Page 28
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.2.3 Ext-interrupt .c
In this function, external interrupt registers 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
Following table describes the function EXT_Init.
Function name
EXT_Init
Function prototype
void EXT_Init(void)
Behavior description
Initialize external interrupt module
Input parameter
None
Return value
None
Example
Set external channel to INT04, falling edge trigger and enable interrupt:
EXT_Init();
Following table describes the function INTER_EXT.
Function name
INTER_EXT
Function prototype
__interrupt void INTER_EXT(void)
Behavior description
Indicate the send key pressed
Input parameter
None
Return value
None
Interrupt Level
IRQ0: external interrupt ch0 | ch4
Example
Be used in file vectors:
__interrupt void INTER_EXT(void);
MCU-AN-500083-E-12 – Page 29
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.2.4 I2C .c
All following functions are for IIC0 which works as master.
Following table describes the I2C library.
Function Name
Description
void I2C_Init( void )
Initialize I2C register
unsigned char Read_I2C(unsigned char DevAddr,
unsigned char SubAddr)
Read data for slave
void Write_I2C(unsigned char DevAddr, unsigned char
SubAddr, unsigned char WDat)
Write data to slave
Following table describes function I2C_Init.
Function name
I2C_Init
Function prototype
void I2C_Init( void )
Behavior description
Initialize IIC0 module
Input parameter
None
Return value
None
Example
Set I2C clock to 6.1khz,set I2C0 to master mode, disable interrupt:
I2C_Init ();
Following table describes function Read_I2C.
Function name
Read_I2C
Function prototype
unsigned char Read_I2C(unsigned char DevAddr, unsigned char
SubAddr)
Behavior description
Read data from slave device
Input parameter1
DevAddr: slave device address
Input parameter2
SubAddr: slave device sub-address
Return value
Data read from slave device
Example
Read data from EEPROM sub-address 0x22:
[variable] = Read_I2C(0xa0,0x22);
MCU-AN-500083-E-12 – Page 30
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
Following table describes function Write_I2C.
Function name
Write_I2C
Function prototype
void Write_I2C(unsigned char DevAddr, unsigned char SubAddr, unsigned
char WDat)
Behavior description
Write data to slave device
Input parameter1
DevAddr: slave device address
Input parameter2
SubAddr: slave device sub-addres
Input parameter3
WDat: data written to slave device
Return value
None
Example
Write data 0x18 to EEPROM sub-address 0x22:
Write_I2C (0xa0,0x22,0x18);
4.2.5 Initial .c
Following table describes the initial library:
Function Name
Description
void Initial(void)
Initialize global variable
Following table describes how to use these functions.
Function name
Initial
Function prototype
void Initial(void)
Behavior description
Initialize global parameter
Input parameter
None
Return value
None
Example
Initialize key status to 0 and coordinate status to 0:
Initial ();
MCU-AN-500083-E-12 – Page 31
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.2.6 Slavemodei2c .c
Following table describes the slavemodei2c library.
Function Name
Description
void SlaveI2C_PrepareForInter(void)
Initialize IIC1 as slave
__interrupt void INTER_I2CSlaveModeWakeUp(void)
IIC1 receives interrupt
Following table describes how to use function SlaveI2C_PrepareForInter.
Function name
SlaveI2C_PrepareForInter
Function prototype
void SlaveI2C_PrepareForInter(void)
Behavior description
Initialize I2C slave mode channel IIC1
Input parameter
None
Return value
None
Example
Initialize IIC1 clock to 115khz, set IIC1 to slave mode, enable IIC1 wake
up system and enable interrupt:
SlaveI2C_PrepareForInter();
Following table describes how to use function INTER_I2CSlaveModeWakeUp.
Function name
INTER_I2CSlaveModeWakeUp
Function prototype
__interrupt void INTER_I2CSlaveModeWakeUp(void)
Behavior description
When IIC slave received data, system enter into interrupt
Input parameter
None
Return value
None
Interrupt Level
IRQ10: 8/16-bit PPG ch1 (upper) | I2C ch1
Example
Be used in file vectors:
__interrupt void INTER_I2CSlaveModeWakeUp(void);
MCU-AN-500083-E-12 – Page 32
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.2.7 Standby .c
Following table describes the standby library.
Function Name
Description
void STBLED_ON(unsigned char LEDSwiDat)
LED show standby status
void Write_StandBy(void)
Go to standby
Following table describes how to use function STBLED_ON.
Function name
STBLED_ON
Function prototype
void STBLED_ON(unsigned char LEDSwiDat)
Behavior description
Make standby LED on or off
Input parameter
LEDSwiDat: 0 --- LED1 will off
1 --- LED1 will on
Return value
None
Example
Make LED1 on:
STBLED_ON(1);
Following table describes how to use function Write_StandBy.
Function name
Write_StandBy
Function prototype
void Write_StandBy(void)
Behavior description
Write data to let system enter into stop mode
Input parameter
None
Return value
None
Example
Make system enter into stop mode:
Write_StandBy();
MCU-AN-500083-E-12 – Page 33
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.2.8 Timer.c
Following table describes the timer library.
Function Name
Description
void Clock_Init(void)
system clock initialization
Following table describes how to use function Clock_Init.
Function name
Clock_Init
Function prototype
void Clock_Init(void)
Behavior description
Select clock mode
Input parameter
None
Return value
None
Example
Make system enter main CR clock and enable I2C pin:
Clock_Init();
MCU-AN-500083-E-12 – Page 34
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.3
API Code File Description
API files are used to transfer drive file. They are shown as below,
Figure 4-3: API Code Files
4.3.1 I2CMasterMacro.c
In this function,
Following table describes I2C master library.
Function Name
Description
unsigned char Judge_P00(void)
Judge p00 status
void LEDCoordin(unsigned char LedStatus)
Make LED2 on or off
void EEPROM_I2C(void)
Write data to EEPROM
void EndDevice_I2C(void)
Write data to external slave device
void I2C_MasterMacro(void)
When use I2C master mode use it
Following table describes how to use function Judge_P00.
Function name
Judge_P00
Function prototype
unsigned char Judge_P00(void)
Behavior description
Judge the jumper connected to EEPROM or external device
Input parameter
None
Return value
The jumper connect status:
0 --- I2C master connect to external slave device
1 --- I2C master connect to EEPROM
Example
[variable] = Judge_P00 ();
Following table describes how to use function LEDCoordin.
Function name
LEDCoordin
Function prototype
void LEDCoordin(unsigned char LedStatus)
Behavior description
When the board coordinate successfully, the LED2 will on
Input parameter
LedStatus: 0 --- off LED2
1 --- light on LED2
Return value
None
Example
Make LED2 on:
LEDCoordin(1);
MCU-AN-500083-E-12 – Page 35
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
Following table describes how to use function EEPROM_I2C.
Function name
EEPROM_I2C
Function prototype
void EEPROM_I2C(void)
Behavior description
When Judge_P00(void) function return 1, IIC0 will write data to EEPROM
when “send” key pressed
Input parameter
None
Return value
None
Example
IIC0 write data to EEPROM:
EEPROM_I2C();
Following table describes how to use function EndDevice_I2C.
Function name
EndDevice_I2C
Function prototype
void EndDevice_I2C(void)
Behavior description
When Judge_P00(void) function return 0, IIC0 will write data to external
slave device, when “send” key pressed
Input parameter
None
Return value
None
Example
IIC0 write data to external slave device:
EndDevice_I2C();
Following table describes how to use function I2C_MasterMacro.
Function name
I2C_MasterMacro
Function prototype
void I2C_MasterMacro(void)
Behavior description
when “send” key pressed will write data to slave device
Input parameter
None
Return value
None
Example
Used in main.c:
I2C_MasterMacro();
MCU-AN-500083-E-12 – Page 36
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.3.2 I2CSlaveMacro.c
Following table describes the I2C slave library.
Function Name
Description
void I2C_SlaveMacro(void)
Decide MCU address
When IIC0 is connected to multiple slaves, these five constants are used decide which one
to access.
Following table describes how to use function I2C_SlaveMacro.
Function name
I2C_SlaveMacro
Function prototype
void I2C_SlaveMacro(void)
Behavior description
Set MCU address
Input parameter
None
Return value
None
Example
Used in main.c:
I2C_SlaveMacro();
Note: the MCU address register IAAR1 must set to the value half of MCU address.
MCU-AN-500083-E-12 – Page 37
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.3.3 SleepMacro.c
In this function,
Following table describes the sleep library.
Function Name
Description
void Sleep_Macro(void)
Make system enter into stop mode
Following table describes how to use function Sleep_Macro.
Function name
Sleep_Macro
Function prototype
void Sleep_Macro(void)
Behavior description
Make system enter into stop mode
Input parameter
None
Return value
None
Example
Used in main.c:
Sleep_Macro();
MCU-AN-500083-E-12 – Page 38
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.4
Global Variable Description
Five drive files are available in this project shown below.
Figure 4-4: H Files
9
_f2mc8fx.h
_f2mc8fx.h is system-defined document. Ignore it
9
mb95350l.h
Mb95350l.h is system-defined document. Ignore it
9
def.h
This file basically includes all global variables of FW
Following picture describes the global variable.
typedef struct
{
unsigned char CoordiFlag; //flag for slave and master coordinate
is successfully
unsigned char DatSlavI2CRead; //slave i2c read data
unsigned char KeyStatus;
unsigned char AddrMCU;
//record key status
//slave i2c address
}Global;
typedef struct
{
unsigned char TBT_Hour;
//RTC hour
unsigned char TBT_Minute;
//RTC minute
unsigned char TBT_Second;
//RTC second
unsigned int
TBT_Tim;
unsigned char ErrorDet;
//RTC add number every 0.65ms
//detect error enter dead while
unsigned char ErrorFlag;
//flag
unsigned int DeadWhile_Tim;
//count
for
dead
while
out
time
while
}RTCPar;
#define AddrEEPROM
0xa0
MCU-AN-500083-E-12 – Page 39
after
enter
dead
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.5
How to Add These Files
Before using files in section 4.2, 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.
MCU-AN-500083-E-12 – Page 40
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6
Usage Demo
Following table lists all C files.
4.6.1 Code of main.c
InitIrqLevels();
IRQ vector table
// Initialize Interrupt level register and
Initial();
Initial_ADC();
Init_EXT();
TBT_Init();
__EI ();
While (1)
{
I2C_SlaveMacro ();
slave address
// Set as slave mode
and set a
I2C_MasterMacro ();
Sleep_Macro();
//
Go to sleep
}
4.6.2 Code of Initial_ADC
AIDRL_P00 = 0;
//anologe input
DDR0_P00 = 0;
//input
ADC1 = 0x00;
AN00 selected
//start
ADC2 = 0x80;
MCU-AN-500083-E-12 – Page 41
adc,
clear
interrupt,
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.3 Code of Read_ADC
unsigned char i=0,j=0, Vadc;
unsigned int k=0;
for(i=0;i<8;i++)
{
ADC1=0x01;
While (!ADC1_ADI);
j++;
k=k+ADD_ADDL;
}
Vadc = k/8;
ADC1_ADI = 0;
return
//clear interrupt
Vadc;
4.6.4 Code of Judge_SlaveAddr
unsigned char ReturValu;
if((0 <= AddrJudg)&&(AddrJudg <= 0x03))
ReturValu = 0x10;
else if((0x04 <= AddrJudg)&&(AddrJudg <= 0x34))
ReturValu = 0x20;
else if((0x35 <= AddrJudg)&&(AddrJudg <= 0x85))
ReturValu = 0x30;
else if((0x86 <= AddrJudg)&&(AddrJudg <= 0xcc))
ReturValu = 0x40;
else
ReturValu = 0x50;
return ReturValu;
MCU-AN-500083-E-12 – Page 42
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.5 Code of Init_EXT
DDR0_P04 = 0;
//input
PUL0_P04 = 0;
//disable pull up
AIDRL_P04 = 1;
//i/o port use
EIC20 = 0x05;
4.6.6 Code of INTER_EXT
EIC20_EIR0 = 0;
PraGlo.KeyStatus = 1;
//key pressed
4.6.7 Code of I2C_Init
ICCR0_EN
= 0;
// clear I2C interface
ICCR0_CS4 = 0;
// set clock divider 'm' => 5
ICCR0_CS3 = 0;
ICCR0_CS2 = 1;
// set clock divider 'n' => 98
ICCR0_CS1 = 0;
ICCR0_CS0 = 0;
// Fsck = MCLK / (m * n +2) => 3MHz/(5*98 +2)
//= 3MHz/492 = 6.1kHz
IDDR0
IBCR00
= 0x00; // clear data register
= 0x00;
// enable address acknowledge bit,
// transfer completion interrupt after nine
cycles,
// enable stop detection interrupt
IBCR10
= 0x08;
acknowledge bit,
// set to slave mode first, disable data
// disable bus error and transfer complete
interrupt
ICCR0_EN
= 1;
// enable I2C interface
MCU-AN-500083-E-12 – Page 43
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.8 Code of Read_I2C
unsigned char Temp;
I2C_Init ();
I2C_Start (DevAddr);
// Write Comand to ...
I2C_Acknowlegde ();
I2C_Write (SubAddr);
from where to read
I2C_Continue (DevAddr+1) ;
comand
Temp = I2C_LastRead ();
// ... set address
//
Restart,
with
READ
// receive data from
I2C_Stop ();
return (Temp);
4.6.9 Code of Write_I2C
I2C_Init ();
I2C_Start (DevAddr);
I2C_Acknowlegde ();
I2C_Write (SubAddr);
I2C_Write (WDat);
I2C_Stop ();
4.6.10 Code of Initial
PraGlo.KeyStatus = 0;
pressed
PraGlo.CoordiFlag = 0;
PraRtc.ErrorDet = 0;
dead while to 0
//intial
key
status
is
not
//initial coordinate LED to off
//initial
MCU-AN-500083-E-12 – Page 44
error
detected
for
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.11 Code of SlaveI2C_PrepareForInter
ICCR1_EN = 0;
ILSR_P16 = 1;
//coms level
ILSR_P17 = 1;
DDR1_P16 = 0;
DDR1_P17 = 0;
ICCR1_EN
= 0;
// clear I2C interface
ICCR1_CS4 = 0;
// set clock divider 'm' => 6
ICCR1_CS3 = 1 ;
ICCR1_CS2 = 0;
// set clock divider 'n' => 4
ICCR1_CS1 = 0;
ICCR1_CS0 = 0;
// Fsck = MCLK / (m * n +2) => 3MHz/(6*4
+2)
//= 3MHz/26 = 115kHz
ICCR1_EN
IDDR1
= 1;
// enable I2C interface
= 0x00;
// clear data register
IBCR01 = 0x05;//0x04;
// enable address acknowledge bit,
// transfer completion interrupt after nine
cycles,
// enable stop detection interrupt
IBCR11 = 0x4A;
// set slave mode, enable data acknowledge
bit,
// enable bus error and transfer complete
interrupt
MCU-AN-500083-E-12 – Page 45
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.12 Code of INTER_I2CSlaveModeWakeUp
IBCR01_WUE = 0;
//disable i2c wake up interrupt
if (IBCR01_SPF == 0x01)
// stop condition detected
{
IBCR01_SPF = 0x00;
// clear stop condition
}
if (IBCR11_INT == 0x01)
// transfer completed
{
ReaDat = IDDR1;
Tim ++;
if(Tim == 2)
{
Tim = 0;
PraGlo.DatSlavI2CRead = ReaDat;
PraGlo.CoordiFlag
=
1;
//slave
address
same as mcu address
}
IBCR11_INT = 0x00;
// clear bit
DDR0_P05 = 1;
PDR0_P05 = 0;
}
if(IBCR11_BER == 0x01)
// bus error detected
{
IBCR11_BER = 0x00;
// bit cleared
}
MCU-AN-500083-E-12 – Page 46
receive
is
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.13 Code of STBLED_ON
if(LEDSwiDat == 1)
{
PDR0_P07 = 0;
//on
DDR0_P07 = 1;
}
else
{
PDR0_P07 = 1;
//off
DDR0_P07 = 1;
}
4.6.14 Code of Write_StandBy
STBLED_ON(1);
//LED on
SYCC = 0x00;
//main clock
SYCC2 = 0x21;//0x34;
While (STBC_MCRDY==0);
SlaveI2C_PrepareForInter ();
IBCR01_WUE = 1;
//enable i2c wake up
while (IBSR1_BB);
STBC = 0x80;
//Stop ENTERED
STBLED_ON(0);
//LED OFF
Delay(60);
4.6.15 Code of Clock_Init
SYSC = 0x05;
PF/PG is clock use
SYCC = 0x00;
//enable
reset,
enable
//main clock
SYCC2 = 0xe1;
While (STBC_MCRDY==0);
MCU-AN-500083-E-12 – Page 47
I2C1
pin,select
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.16
.6.16 Code of Judge_P00
unsigned char StatuP0;
DDR6_P64 = 0;
StatuP0 = PDR6_P64;
return StatuP0;
4.6.17 Code of LEDCoordin
switch(LedStatus)
{
case 0x00:
//off
DDR0_P06 = 1;
PDR0_P06 = 1;
break;
case 0x01:
//on
DDR0_P06 = 1;
PDR0_P06 = 0;
break;
}
MCU-AN-500083-E-12 – Page 48
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.18 Code of EEPROM_I2C
unsigned char Coordin=0;
if(PraGlo.CoordiFlag == 1)
{
Write_I2C(AddrEEPROM,
PraGlo.DatSlavI2CRead,PraGlo.DatSlavI2CRead);
Coordin = Read_I2C(AddrEEPROM,PraGlo.DatSlavI2CRead);
if(Coordin == PraGlo.DatSlavI2CRead)
LEDCoordin(1);
PraGlo.CoordiFlag = 0;
PDR0_P05 = 1;
}
else
{
Coordin = Read_ADC();
Write_I2C(AddrEEPROM,Coordin,Coordin);
LEDCoordin(0);
}
4.6.19 Code of EndDevice_I2C
unsigned char ValuAdc, AddrEndDevi;
ValuAdc = Read_ADC();
AddrEndDevi = Judge_SlaveAddr(ValuAdc);
Write_I2C(AddrEndDevi, 0x01,0x01);
if(PraGlo.CoordiFlag == 1)
{
Write_I2C(AddrEndDevi,
PraGlo.DatSlavI2CRead,PraGlo.DatSlavI2CRead);
ValuAdc = Read_I2C(AddrEndDevi,PraGlo.DatSlavI2CRead);
if(ValuAdc == PraGlo.DatSlavI2CRead)
LEDCoordin(1);
}
else
{
Write_I2C(AddrEndDevi,ValuAdc,ValuAdc);
LEDCoordin(0);
}
MCU-AN-500083-E-12 – Page 49
MB2146-460-E Setup Guide V1.2
Chapter 4 Sample Code Manual
4.6.20 Code of I2C_MasterMacro
if(PraGlo.KeyStatus == 1)
{
P00Status = Judge_P00 ();
if(P00Status == 1)
EEPROM_I2C ();
else
EndDevice_I2C ();
}
PraGlo.KeyStatus = 0;
4.6.21 Code of I2C_SlaveMacro
unsigned char ReadADC;
ReadADC = Read_ADC();
PraGlo.AddrMCU = Judge_SlaveAddr(ReadADC);
IAAR1 = (PraGlo.AddrMCU>>1);
4.6.22 Code of Sleep_Macro
Write_StandBy();
MCU-AN-500083-E-12 – Page 50
MB2146-460-E Setup Guide V1.2
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 MB95350L 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-500083-E-12 – Page 51
MB2146-460-E Setup Guide V1.2
Chapter 6 Additional Information
6 Additional Information
For more Information on FUJITSU 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-500083-E-12 – Page 52
MB2146-460-E Setup Guide V1.2
Chapter 7 Appendix
7 Appendix
7.1
Tables
Table 3-1: Assignment of Pin ................................................................................................. 16 Table 3-2: Selection of Power Supply .................................................................................... 17 7.2
Figures
Figure 1-1: System Block ......................................................................................................... 6 Figure 2-1: BGMA Overview .................................................................................................... 8 Figure 2-2: Install BGMA in Windows (1) ................................................................................. 9 Figure 2-3: Install BGMA in Windows (2) ............................................................................... 10 Figure 2-4: Install BGMA in Windows (3) ............................................................................... 10 Figure 2-5: Install BGMA in Windows (4) ............................................................................... 11 Figure 2-6: BGMA is installed in Windows ............................................................................. 11 Figure 2-7: BGMA Power LED (1) ......................................................................................... 12 Figure 2-8: BGMA Power LED (2) ......................................................................................... 12 Figure 3-1: EV-board Overview ............................................................................................. 13 Figure 3-2: EV-board Schematic ............................................................................................ 15 Figure 3-3: Power Module ...................................................................................................... 17 Figure 3-4: I2C Slave In ......................................................................................................... 18 Figure 3-5: I2C Switch ........................................................................................................... 18 Figure 3-6: ADC Module ........................................................................................................ 19 Figure 3-7: LED Assignment .................................................................................................. 20 Figure 3-8: Single Mode ......................................................................................................... 21 Figure 3-9: Series Mode ........................................................................................................ 22 Figure 3-10: Net Mode ........................................................................................................... 23 Figure 3-11: Potentiometer Grade ......................................................................................... 24 Figure 3-12: Battery Selecting ............................................................................................... 25 Figure 4-1: Project Structure .................................................................................................. 26 Figure 4-2: Source Code Files ............................................................................................... 27 Figure 4-3: API Code Files ..................................................................................................... 35 Figure 4-4: H Files ................................................................................................................. 39 MCU-AN-500083-E-12 – Page 53