background image

Starter Kit MB2146-410-01-E Setup Guide V1.1 

Chapter 4 Sample Code Manual 

MCU-UM-500002-E-11 – Page

 

19 

#define PDR0_P03 _pdr0.bit._P03 

#define PDR0_P04 _pdr0.bit._P04 

#define PDR0_P05 _pdr0.bit._P05 

#define PDR0_P06 _pdr0.bit._P06 

#define PDR0_P07 _pdr0.bit._P07 

 

In MB95200H/210H.asm, PDR0 address 0x0000 is allocated to PDR0 as below. 

__pdr0   .res.b 1             ;000000  /* Port0 */ 

PDR0    .equ 0x0000 

4.3.2  Startup.asm File 

The  Startup.asm  is  the  MB95200H/210H  MCU  initialization  file  including  stack  settings, 
register bank settings and watchdog settings etc; 

4.3.3  Vectors.c File. 

The Vectors.c contains the MB95200H/210H MCU Interrupt vector definition. 

User can pre-set all interrupt control registers in function InitIrqLevels(). It can be used to set 
all interrupt priorities in static applications. For example, to set the external interrupt ch.0 to 
level 0, change the following code: 

ILR0 = 0xFF;      //  IRQ0:  external interrupt ch.0 | ch.4 

                           //  IRQ1:  external interrupt ch.1 | ch.5  

                           //  IRQ2:  external interrupt ch.2 | ch.6 

                           //  IRQ3:  external interrupt ch.3 | ch.7 

To 

ILR0 = 0xFC;      //  IRQ0:  external interrupt ch.0 | ch.4 

                      //  IRQ1:  external interrupt ch.1 | ch.5  

                      //  IRQ2:  external interrupt ch.2 | ch.6 

                      //  IRQ3:  external interrupt ch.3 | ch.7 

And declare the interrupt function as in Vectors.c below, 

…… 

__interrupt void external_int00 (void); 

…… 

#pragma intvect external_int00   0   //  IRQ0:  external interrupt ch0 | ch4 

Then user can write his own interrupt sub-routine in Main.C shown as below. 

 

/*--------------------- INTERRUPT SERVICE ROUTINE ---------------------------*/ 

__interrupt void external_int00(void) 

 

//User code 

Summary of Contents for MB2146-410-01-E

Page 1: ...FUJITSU MICROELECTRONICS SUPPORT SYSTEM MCU UM 500002 E 11 F MC 8FX FAMILY 8 BIT MICROCONTROLLER MB95200H 210H SERIES STARTER KIT MB2146 410 01 E SETUP GUIDE ...

Page 2: ......

Page 3: ...es or support representatives 1 F2MC is the abbreviation of FUJITSU Flexible Microcontroller 2 Referred below as the Starter Kit 3 Referred below as the BGMA 4 Referred below as the EV Board 5 Referred below as the SOFTUNE Handling and use Handling and use of this product and notes regarding its safe use are described in the manuals for products bundled with the Starter Kit Follow the instructions...

Page 4: ...tains many electronic components keep it away from direct sunlight high temperature and high humidity to prevent condensation Do not use or store the product where it is exposed to much dust or a strong magnetic or electric field for an extended period of time Inappropriate operating or storage environments may cause a fault Damage Use the product within the ranges given in the specifications Oper...

Page 5: ... 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 ...

Page 6: ...iew 3 2 2 Function List 3 2 3 IDC10 Interface Description 4 2 4 BGMA USB Configuration 4 2 5 LED Description 7 3 EV BOARD MANUAL 8 3 1 EV board Overview 8 3 2 Function List 9 3 3 EV board Schematic 10 3 4 HW Module Description and Jumper settings 11 3 4 1 Power Module 11 3 4 2 BGMA Interface 12 3 4 3 Clock Settings 12 3 4 4 Buzzer Module 12 3 4 5 A D Module 13 3 4 6 LED Module 13 3 4 7 Key Module ...

Page 7: ...Setup Guide V1 1 Contents v 4 3 2 Startup asm File 19 4 3 3 Vectors c File 19 4 3 4 Main c File 20 5 DEVELOPMENT PLATFORM QUICK START 21 5 1 Tools Setup Sequence 21 5 2 Open Project and Start Debug 21 5 3 Operation Precautions 21 ...

Page 8: ......

Page 9: ...ng devices are placed in the package BGMA MB2146 08 E 1PCS EV board MB2146 410 E 1PCS USB cable 1PCS CD ROM SOFTUNE user manuals sample code 1PCS Hardcopy China RoHS report quick start guide 1PCS AA battery 4PCS 1 2 System Block To setup a debugging system connect a PC a BGMA and an EV board together as shown below Figure 1 2 1 System Block 1 3 Handling Precautions The Starter Kit can be used in c...

Page 10: ...etc of each device relation for the operation voltage and frequency of MCU of operation Compact development environment a light and small BGM Adapter Since a monitor program is performed in exclusive memory space it does not consume user memory space Continuation execution step execution and break correspondence It connects with a host computer by the USB interface 1 5 Hardware Setup In the hardwa...

Page 11: ... size 128mmX55mmX29mm Figure 2 1 1 BGMA overview 2 2 Function List ID Function description Remarks 1 Support 8FX MB95200H 210H Series MCU MCU MAX machine clock 16 25 MHz MCU power voltage 2 4 V 5 5 V 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 MB95200H 210H MCU The Baud rate is 62 500 bps 5 Support the...

Page 12: ...et 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 2 4 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 4 1 Install BGM...

Page 13: ...BGMA Manual MCU UM 500002 E 11 Page 5 Select Install from a list or specific location Advanced then click Next Figure 2 4 2 Install BGMA in Windows 2 Select Drivers from the folder where SOFTUNE is installed click Next Figure 2 4 3 Install BGMA in Windows 3 ...

Page 14: ... 08 as displayed below and then click Next Figure 2 4 4 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 4 5 BGMA is installed in Windows ...

Page 15: ... to PC check the Power LED on BGMA turns Green Refer to Figure 2 5 1 Figure 2 5 1 BGMA Power LED 1 Second plug IDC10 cable to the EV board target MCU board then turn on EV board After that check Power LED on the BGMA turns Orange Refer to Figure 2 5 2 Figure 2 5 2 BGMA Power LED 2 Green USB Plugged to PC Orange 5V Power through IDC Cable ...

Page 16: ...or the MB95200H 210H MCU Family microcontroller Figure 3 1 1 below is a close look of EV board Figure 3 1 1 EV board Overview MB95200H 210H MCU Debug Interface to BGMA Power supply either from batteries below the PCB or from 2 pin header Circuit for LIN UART peripheral communication Switch circuit to MCU External Interrupt pins Buzzer circuit Potentiometer to MCU AD pin LEDs to MCU I O port pins J...

Page 17: ... It features the following functions Clock and sub clock USB 5V power IF external 5V power IF and the battery Reset circuit and reset key Provide IDC10 debug interface LEDs for general use LED1 indicates DBG pin work status Provide one buzzer to demonstrate timer output 2 keys for general use Potentiometer and temperature sensor RS 232 level converter and DB9 interface MAX232 LIN circuit reserved ...

Page 18: ...Starter Kit MB2146 410 01 E Setup Guide V1 1 Chapter 3 EV board Manual MCU UM 500002 E 11 Page 10 3 3 EV board Schematic Figure 3 3 1 EV board Schematic ...

Page 19: ...ower supply to the EV board If any of the power supplies is connected to the EV board correctly power LED LED5 on the EV board will be on Refer to Figure 3 4 1 1 Figure 3 4 1 1 Power Module To select different power supplies follow the table below Power supply Header name Settings 4 AA batteries from BT1 on the back of the EV board J1 BAT 9V DC from CN6 J1 9V Table 3 4 1 1 Power Supply Selection ...

Page 20: ...g Interface MCU Mode Header name Settings Debug mode J2 User mode J2 3 4 3 Clock Settings The MB95200H 210H series MCU uses an internal main RC as a clock source by default Users can select on board crystal as a main clock and a sub clock Follow the settings below Clock Header name Settings Main clock SW3 X1 X0 Sub clock SW3 X1A X0A Table 3 4 3 1 3 4 4 Buzzer Module A buzzer module is provided to ...

Page 21: ...CU A D channel 1 and VR3 is connected to MCU A D channel 0 Modules Header name Settings A D VR1 SW2 VR1 A D VR3 SW2 VR3 Table 3 4 5 1 3 4 6 LED Module There are four LEDs on EV board to demonstrate the I O function Enable LED2 LED3 and LED4 in the following table Modules Header name Settings SW2 LED2 LED3 LED LED2 LED3 LED4 SW1 LED4 Table 3 4 6 1 LED module has four LEDs in total but P12 LED1 is n...

Page 22: ... name Settings Key S1 S2 SW2 S1 S2 Table 3 4 7 1 3 4 8 Lin UART Module Lin UART module can be configured as a LIN or an UART module Enable each module by the following table The UART module features an RS232 transceiver and a standard DB9 interface with PC Lin module enables a easy setup of Master Slave communication by a Lin bus Modules Header name Settings SW2 SOT SIN UART J5 UART J6 UART SW2 SC...

Page 23: ... 3 LEDs will be on in the following sequence LED4 LED3 LED2 Press Key S2 the 3 LEDs will be on in the following sequence LED2 LED3 LED4 UART project In this example the MCU works in an asynchronous mode 9 600bps 1 stop bit no parity After a reset the MCU will send Welcome to the LIN UART asynchronous mode of MB95200H 210Hseries 8FX to RS232 transceiver Then the MCU feedbacks any bytes it received ...

Page 24: ...l MCU UM 500002 E 11 Page 16 LIN master In this example the MCU is running in a Lin Master mode After a reset the MCU starts sending data to a Slave If the Master gets correct data from the Slave the MCU restarts sending While sending data to the Slave LED2 keeps twinkling ...

Page 25: ...Chapter 4 Sample Code Manual MCU UM 500002 E 11 Page 17 4 2 Project Structure The Sample code is organized by the following structure in each project Here take IO_LED project for example shown in Figure 4 2 1 Figure 4 2 1 I O_LED Project Structure ...

Page 26: ...210H asm are header files including MB95200H 210H MCU I O registers definition Here take PDR0 for example In MB95200H 210H h PDR0 is defined as below REGISTER BIT STRUCTURES typedef union Port0 IO_BYTE byte struct IO_BYTE _P07 1 IO_BYTE _P06 1 IO_BYTE _P05 1 IO_BYTE _P04 1 IO_BYTE _P03 1 IO_BYTE _P02 1 IO_BYTE _P01 1 IO_BYTE _P00 1 bit PDR0STR __IO_EXTERN __io PDR0STR _pdr0 Port0 define PDR0 _pdr0...

Page 27: ...er can pre set all interrupt control registers in function InitIrqLevels It can be used to set all interrupt priorities in static applications For example to set the external interrupt ch 0 to level 0 change the following code ILR0 0xFF IRQ0 external interrupt ch 0 ch 4 IRQ1 external interrupt ch 1 ch 5 IRQ2 external interrupt ch 2 ch 6 IRQ3 external interrupt ch 3 ch 7 To ILR0 0xFC IRQ0 external ...

Page 28: ...Starter Kit MB2146 410 01 E Setup Guide V1 1 Chapter 4 Sample Code Manual MCU UM 500002 E 11 Page 20 4 3 4 Main c File Main c contains the user code ...

Page 29: ...owing sequence Here take IO_LED project for example Start the SOFTUNE from Startup Menu Programs SOFTUNE V3 FFMC 8L Family SOFTUNE Workbench in Windows Click Open workspace from File Menu in SOFTUNE Select IO_LED wsp in Open Space window Click Start debug from Debug Menu If the entire procedure goes right a debug will start normally 5 3 Operation Precautions All pins of MB95200H 210H MCU are conne...

Page 30: ...002 E 11 FUJITSU MICROELECTRONICS LIMITED SUPPORT SYSTEM F2MC Family Starter Kit MB2146 410 01 E SETUP GUIDE April 2008 the second edition Published FUJITSU MICROELECTRONICS LIMITED Edited Business Promotion Dept ...

Page 31: ......

Reviews: