13
Fujitsu Semiconductor Design (Chengdu) Co., Ltd. Application Note MCU-AN-500099-E-10 F²MC-8FX FAMILY 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ENERGY METER REFERENCE SOLUTION APPLICATION NOTE

8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

Fujitsu Semiconductor Design (Chengdu) Co., Ltd. Application Note

MCU-AN-500099-E-10

F²MC-8FX FAMILY 8-BIT MICROCONTROLLER

MB95200 /210H SERIES

ONE PHASE ENERGY METER

REFERENCE SOLUTION

APPLICATION NOTE

Page 2: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 0BRevision History

Revision History Version Date Updated by Modifications

1.0. 9/27/2010 Lori, Li First draft

This manual contains 13 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 Design (Chengdu) Co., Ltd.

MCU-AN-500099-E-10 – Page 2

Page 3: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 1BContents

CONTENTS

REVISION HISTORY .............................................................................................................. 2 

CONTENTS ............................................................................................................................ 3 

1  INTRODUCTION ................................................................................................................ 4 

2  DEMO PLATFORM ............................................................................................................ 5 2.1  Platform ..................................................................................................................... 5 

3  FEATURES ........................................................................................................................ 6 3.1  Energy Consumption Measurement .......................................................................... 6 

3.2  Register Display ........................................................................................................ 6 

3.3  RS485 or Carrier Wave Communication ................................................................... 6 

3.4  IR Communication..................................................................................................... 6 

4  HARDWARE ...................................................................................................................... 7 4.1  System Block Diagram .............................................................................................. 7 

4.2  Schematic ................................................................................................................. 8 

4.3  MCU Pin Assignment ................................................................................................ 9 

4.4  Connecting Method ................................................................................................... 9 

5  FIRMWARE ...................................................................................................................... 10 5.1  Flowchart ................................................................................................................ 10 

5.2  Firmware Project ..................................................................................................... 11 

6  ADDITIONAL INFORMATION ......................................................................................... 12 

7  APPENDIX ....................................................................................................................... 13 7.1  Tables ..................................................................................................................... 13 

7.2  Figures .................................................................................................................... 13 

MCU-AN-500099-E-10 – Page 3

Page 4: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 1 2BIntroduction

1 Introduction Electronic single phase energy meter is designed based on MB95F204K and special energy measurement chip ADE7755. With advantages of few components, simple construction, high reliability, low power and long service life, it can be used to measure the single phase AC active energy consumption at a frequency of 50Hz.

It can realize remote meter reading by RS485 communication or carrier wave communication. Register display can show the history of electricity consumption. The user can read and modify the parameter of the energy meter through IR communication with special equipment. When power off, the energy meter can store the necessary data from RAM to EEPROM.

This demo set supports features below:

Energy consumption measurement

Register display

RS485 or Carrier wave communication

IR communication

MCU-AN-500099-E-10 – Page 4

Page 5: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 2 3BDemo Platform

2 Demo Platform

Demo Platform of Energy Meter

2.1 Platform Figure 2-1 shows the demo platform of electronic single phase energy meter. It can be used to measure the single phase AC active energy consumption at a frequency of 50Hz.

Figure 2-1: Demo Platform

MCU-AN-500099-E-10 – Page 5

Page 6: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 3 4BFeatures

3 Features

Features of Energy Meter

3.1 Energy Consumption Measurement The AD7755 is an electrical energy measurement IC with high accuracy. It is intended for use with two-wire distribution systems. The AD7755 supplies average real power information as the low frequency outputs to F1 and F2. These logic outputs may be used to directly drive electromechanical counter or interface to an MCU. The CF logic output provides instantaneous real power information.

3.2 Register Display Register display is driven by the IOs to display the average real power information.

3.3 RS485 or Carrier Wave Communication Use RS485 or carrier wave communication for remote meter reading.

3.4 IR Communication Use IR handset to read or modify some parameters.

MCU-AN-500099-E-10 – Page 6

Page 7: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 4 5BHardware

4 Hardware

Hardware of Energy Meter

4.1 System Block Diagram Figure 4-1 shows the demo system block diagram. The demo one phase energy meter is developed based on MCU MB95F204K.

MCU: AD module, UART module, extern interrupt and composite timer

Register display

RS485 bus / Carrier wave

Power voltage detective

EEPROM

IR

Energy consumption measurement

Figure 4-1: System Block Diagram

MCU-AN-500099-E-10 – Page 7

Page 8: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 4 5BHardware

4.2 Schematic Figure 4-2 shows the schematic.

Figure 4-2: One Phase Energy Meter

MCU-AN-500099-E-10 – Page 8

Page 9: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 4 5BHardware

4.3 MCU Pin Assignment Table 4-1 shows the MB95F204K pin assignment in this system.

Table 4-1: Pin Assignment Pin Number Pin Function

4 X1A/PG2 I2C_SDA

5 X0A/PG1 I2C_SCL

9 T010/P62 F1 signal

10 T011/P63 F2 signal

12 P00/AN00 Lower power detected

19 P07 IR_RXD

18 P06 IR_TXD

16 P04 485 communication RXD

15 P03 485 communication TXD

4.4 Connecting Method

Figure 4-3: Connecting Method

①③terminal: 220V AC input terminal

②④terminal: load output terminal

⑤⑦terminal: Calibrated pulse output terminal, ⑤→+⑦→-

⑥⑧terminal: RS485 bus interface,⑥→A line ⑧→ line

MCU-AN-500099-E-10 – Page 9

Page 10: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 5 6BFirmware

5 Firmware

Firmware of Energy Meter

5.1 Flowchart The software of electronic single phase energy meter is composed of eeprom_driver.c, i2c.c, main.c, signal_stream.c, sys_timer_driver.c and system.c.

The description of main loop function is shown in Figure 5-1.

Figure 5-1: Main Loop Flowchart

MCU-AN-500099-E-10 – Page 10

Page 11: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 5 6BFirmware

5.2 Firmware Project This demo uses MB95F204K to implement all the functions. MB2146-08-E and SOFTUNE V3 are used to debug the demo.

The table below explains the functions of the main files. Table 5-1: One Phase Energy Meter Functions

Files Function

Main.c Main function

Eeprom_driver.c External EEPROM read/write

I2c.c I2C bus read/write is for EEPROM

Signal_stream.c Deal with IR and RS485 communication

Sys_timer_driver.c Operation of software real timer clock

System.c System control function

Ma95200.asm FUJITSU MCU head file

Startup.asm MCU configure file

Vecter.c Interrupt setting file

The project is shown in Figure 5-2 Demo Project.

Figure 5-2: Demo Project

MCU-AN-500099-E-10 – Page 11

Page 12: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 6 7BAdditional 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-500099-E-10 – Page 12

Page 13: 8-BIT MICROCONTROLLER MB95200 /210H SERIES ONE PHASE ... · One Phase Energy Meter V1.0 Chapter 1 2BIntroduction . 1 Introduction . Electronic single phase energy meter is designed

One Phase Energy Meter V1.0 Chapter 7 8BAppendix

MCU-AN-500099-E-10 – Page 13

7 Appendix

7.1 Tables Table 4-1: Pin Assignment ....................................................................................................... 9 

Table 5-1: One Phase Energy Meter Functions ..................................................................... 11 

7.2 Figures Figure 2-1: Demo Platform ....................................................................................................... 5 

Figure 4-1: System Block Diagram .......................................................................................... 7 

Figure 4-2: One Phase Energy Meter ...................................................................................... 8 

Figure 4-3: Connecting Method ............................................................................................... 9 

Figure 5-1: Main Loop Flowchart ........................................................................................... 10 

Figure 5-2: Demo Project ....................................................................................................... 11