PIC18F85J90-I/PT Microchip Technology, PIC18F85J90-I/PT Datasheet

no-image

PIC18F85J90-I/PT

Manufacturer Part Number
PIC18F85J90-I/PT
Description
IC PIC MCU FLASH 16KX16 80TQFP
Manufacturer
Microchip Technology
Series
PIC® 18Fr

Specifications of PIC18F85J90-I/PT

Core Size
8-Bit
Program Memory Size
32KB (16K x 16)
Core Processor
PIC
Speed
40MHz
Connectivity
I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, LCD, LVD, POR, PWM, WDT
Number Of I /o
67
Program Memory Type
FLASH
Ram Size
2K x 8
Voltage - Supply (vcc/vdd)
2 V ~ 3.6 V
Data Converters
A/D 12x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
80-TFQFP
Controller Family/series
PIC18
No. Of I/o's
67
Ram Memory Size
2KB
Cpu Speed
40MHz
No. Of Timers
4
No. Of Pwm Channels
2
Processor Series
PIC18F
Core
PIC
Data Bus Width
8 bit
Data Ram Size
2 KB
Interface Type
AUSART, EUSART, I2C, SPI
Maximum Clock Frequency
40 MHz
Number Of Programmable I/os
67
Number Of Timers
4
Maximum Operating Temperature
+ 85 C
Mounting Style
SMD/SMT
3rd Party Development Tools
52715-96, 52716-328, 52717-734, 52712-325, EWPIC18
Development Tools By Supplier
PG164130, DV164035, DV244005, DV164005, PG164120, DV164136, DM163030
Minimum Operating Temperature
- 40 C
On-chip Adc
10 bit, 12 Channel
Package
80TQFP
Device Core
PIC
Family Name
PIC18
Maximum Speed
40 MHz
Operating Supply Voltage
2.5|3.3 V
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With
AC162079 - HEADER MPLAB ICD2 18F85J90 64/80AC164328 - MODULE SKT FOR 80TQFP
Eeprom Size
-
Lead Free Status / Rohs Status
 Details

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18F85J90-I/PT
Manufacturer:
MICROCHIP
Quantity:
3 000
Part Number:
PIC18F85J90-I/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
MCP3909
and PIC18F85J90
Single Phase Energy Meter
Reference Design
© 2009 Microchip Technology Inc.
DS51884A

Related parts for PIC18F85J90-I/PT

PIC18F85J90-I/PT Summary of contents

Page 1

... Single Phase Energy Meter © 2009 Microchip Technology Inc. MCP3909 and PIC18F85J90 Reference Design DS51884A ...

Page 2

... REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. ...

Page 3

... The Microchip Web Site ........................................................................................ 8 Customer Support ................................................................................................. 8 Document Revision History ................................................................................... 8 Chapter 1. Product Overview 1.1 Introduction ..................................................................................................... 9 1.2 What the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Kit Includes ................................................................................. 10 1.3 Getting Started ............................................................................................. 11 Chapter 2. Hardware 2.1 Input and Analog Front End ......................................................................... 13 2.2 Power Supply Circuit .................................................................................... 14 2 ...

Page 4

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Appendix A. Schematic and Layouts A.1 Introduction .................................................................................................. 49 A.2 Board Schematic - Page 1 ........................................................................... 50 A.3 Board Schematic - Page 2 ........................................................................... 51 A.4 Board Schematic - Page 3 ........................................................................... 52 A.5 Board - Top Layer And Silk-screen .............................................................. 53 A.6 Board - Top Copper ..................................................................................... 54 A.7 Board - Bottom Layer and Silk-screen ........................................................ 55 A ...

Page 5

... Select the Help menu, and then Topics to open a list of available on-line help files. INTRODUCTION This chapter contains general information that will be useful to know before using the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design. Items discussed in this chapter include: • Document Layout • ...

Page 6

... Chapter 3. “PIC18F85J90 Calculation and Register Description” – This section describes the digital signal flow for all power output quantities such as RMS current, RMS voltage, active power, and apparent power. This section also includes the calibration registers detail. • ...

Page 7

... N‘Rnnnn Text in angle brackets < > Courier New font: Plain Courier New Italic Courier New Square brackets [ ] Curly brackets and pipe character Ellipses... © 2009 Microchip Technology Inc. Represents Referenced books MPLAB Emphasized text ...is the only compiler... A window the Output window A dialog ...

Page 8

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design RECOMMENDED READING This user's guide describes how to use MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. MCP3909 Data Sheet, “Energy Metering IC with SPI Interface and Active Power Pulse Output“ ...

Page 9

... PIC firmware presented herein. The “Single Phase Energy Meter Software” offers a functional and simple means to monitor and control the PIC18F85J90 and can be used to create custom calibration setups. In some situations, only a single point calibraton may be required. The energy meter software offers an automated step by step calibration process that can be used to quickly calibrate energy meters ...

Page 10

... FIGURE 1-2: Functional Block Diagram. 1.2 WHAT THE MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN KIT INCLUDES This MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design Kit includes: • MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design, 102-00130 • Important Information Sheet DS51884A-page 10 ...

Page 11

... GETTING STARTED To describe how to use the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design, the following example is given using a 2-Wire 1-phase, 220V AC line voltage and connections using an energy meter calibrator equipment or other programmable load source. The meter design uses a 5A load for calibration current ...

Page 12

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 12 © 2009 Microchip Technology Inc. ...

Page 13

... FB = ferrite beads. Ferrite beads have an impedance of the specified value at 100 MHz. FIGURE 2-1: Analog Front End, Phase A Connections and Reference Designators shown. © 2009 Microchip Technology Inc. MCP3909/PIC18F85J90 SINGLE PHASE ENERGY METER REFERENCE DESIGN Chapter 2. Hardware , the channel 1 input signal size will be 490 mV RMS 1.0 kΩ ...

Page 14

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 2.2 POWER SUPPLY CIRCUIT The power supply circuit for the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design uses a half wave rectified signal and a single +5V voltage regulator, and a 3.3V LDO. +9V DS Power In (DO NOT USE WHILE ...

Page 15

... RH5 RC7/RX RC6/TX RA2 RA3 RC2/CCP1 RA0 RJ7 RC3/SCK RC5/SDO RC4/SDI RA0 RB4 RB5 FIGURE 2-3: MCP3909/PIC18F85J90 Digital Connections. © 2009 Microchip Technology Inc. ACTIVE POWER UART - PC MAX3323 ANALOG FRONT END MCLK MCLR 16-bit Multi-level HPF1 ΔΣ ADC CS SCK SDI ...

Page 16

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 16 © 2009 Microchip Technology Inc. ...

Page 17

... Calculation and Register Description Chapter 3. 3.1 REGISTER OVERVIEW The PIC18F85J90 contains registers that are used during calibration and registers that can be read through the UART. The registers are named to describe each phase, specific measurement, and in the case of the calibration registers, the calibration function. ...

Page 18

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.2 ACTIVE ENERGY CALCULATION Active Energy is described through the process described in Figure 3-1. The calibration registers for each calculation are shown as well as the output registers. ADC PGA CURRENT MCP3909 ADC VOLTAGE FIGURE 3-1: Active Energy Calculation. ...

Page 19

... Not implemented — Reserved 16 — Reserved 16 — Reserved — — End of PIC18F85J90 RAM 8 R/W Phase A delay (delay between voltage and current, voltage is time shifted) 8 — Reserved 32 R/W Active power offset, Phase A 16 R/W Active power gain adjust for Phase A, for CF matching 16 ...

Page 20

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4 CONFIGURATION AND OUTPUT REGISTERS 3.4.1 MODE1 Register REGISTER 3-1: Name MODE1 The mode register controls the operation of the energy meter. The bit functions are defined below. R/W-0 R/W R/W APP2 APP1 APP0 bit 15 ...

Page 21

... PHA_S: Phase A Sign Bit. (if enabled, see MODE1 bits). Negative active power, this may indicate the CT is wired in backwards = 1 = Operation Normal 0 bit 1-0 Unimplemented: Read as ‘0’ © 2009 Microchip Technology Inc. Calculation and Register Description STATUS1 REGISTER Bits Address Cof 0x004 16 R ...

Page 22

... This is the calibration mode control register. Bit 0 enables calibration mode. When bit 1 is set high, the energy accumulation registers are updated for LINE_CYC line cycles. After this time, bit 1 is set low by the PIC18F85J90 and the update of the energy accumulation registers will stop. This allows the calibration software to set bit 0, clear the registers, set bit 1, and then start reading the energy accumulation registers as well as this register to check the status of bit 1 ...

Page 23

... LSB resolution of 0.1 mW, is specific for the 5(10)A, 220V rating that this meter is designed for). This register is overwritten every LINE_CYC line cycles (written only once if calibration is enabled). © 2009 Microchip Technology Inc. Calculation and Register Description LINE_CYC REGISTER Bits ...

Page 24

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4.8 PHA_VAR_RAW (NOT IMPLEMENTED) REGISTER 3-8: Name PHA_VAR_RAW This is the raw phase A reactive power. This is the register to be read during calibration for calculating the gain values associated with reactive phase y power, PHA_VAR_GAIN and PHA_VAR_GLSB. This register is overwritten every LINE_CYC line cycles (written only once if calibration is enabled) ...

Page 25

... The ENERGY_W_L_RAW register is the register that should be read when calibrating CFNUM and CFDEN. This register is updated every line cycle (updating ends once LINE_CYC line cycles have passed if calibration is enabled). © 2009 Microchip Technology Inc. Calculation and Register Description ENERGY_W_ REGISTERS Bits ...

Page 26

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.4.12 ENERGY_VA_ REGISTER 3-12: Name ENERGY_VA ENERGY_VA_Z ENERGY_VA_L ENERGY_VA_L_RAW These four registers represent the total apparent energy accumulated so far. Energy from each LINE_CYC line cycles is: EQUATION 3-2: ENERGY_VA = ( + PHB_I_RMS_RAW ( + PHC_I_RMS_RAW Where: PERIOD = Note that during calibration, this value, ENERGY_VA_Z, and ENERGY_VA_L_RAW will all have the same value ...

Page 27

... Phase A active power gain to produce X W/LSB. The value is always less than one (for example, 32,767 = 0.9999695). 3.5.5 PHA_VAR_GAIN (NOT IMPLEMENTED) NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.6 PHA_VAR_GLSB (NOT IMPLEMENTED) NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. © 2009 Microchip Technology Inc. Calculation and Register Description PHA_DELAY REGISTER Bit Address Cof 8 0x140 ...

Page 28

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 3.5.7 ENERGY_W_GLSB (NOT IMPLEMENTED) REGISTER 3-18: Name ENERGY_W_GLSB NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.8 ENERGY_VAR_GLSB (NOT IMPLEMENTED) REGISTER 3-19: Name ENERGY_VAR_GLSB NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE. 3.5.9 CREEP_THRESH (NOT IMPLEMENTED) REGISTER 3-20: Name CREEP_THRESH NOT IMPLEMENTED IN THIS FIRMWARE/SOFTWARE RELEASE ...

Page 29

... This calibration register holds the energy value that was accumulated during the standard phase measurement under calibration configuration C1. The software will read this value when performing phase to phase gain matching during active power calibration. © 2009 Microchip Technology Inc. Calculation and Register Description MODE1_DEF REGISTER Bits ...

Page 30

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 30 © 2009 Microchip Technology Inc. ...

Page 31

... Chapter 4. Meter Protocol and Timings 4.1 PIC18F85J90 PROTOCOL The RS-232 port of the PIC18F85J90 is used to access the register map of the meter. In addition to reading and writing of registers, there are also dedicated commands for clearing calibration registers, loading calibration registers, and storing calibration registers to flash. The first byte RS-232 data is an ASCII character that represents the command, and each command has a specific protocol. Each command ends with the ASCII character “ ...

Page 32

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 4.1.1.4 “W” WRITE: WRITE STARTING AT SPECIFIED ADDRESS Write specified bytes. Example: 'W030000102030405060708090A0B0C0D0E0FX'. Returns: 'W030000102030405060708090A0B0C0D0E0FX'. Note: If number of data characters is odd, the last character (the one just prior to the 'X') will be ignored. Command Byte ASCII Data ...

Page 33

... CALIBRATION OVERVIEW The method to calculate the values for the calibration registers in “Chapter 3. “PIC18F85J90 Calculation and Register Description” are described in this chapter. These registers are used to remove offset, set gain and phase adjustments, and include (units)/LSB adjustments for the meter outputs. The calibration flow charts and equations presented in this section are all automated using Microchip’ ...

Page 34

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.1 Calibration of the single phase energy meter involves up to four different test configurations. For example, meter design example 5(10)A, I The four different test configuraitons are listed here Configuration C1: Gain - Basic voltage For example, 220V and 5A. ...

Page 35

... PHA_W:32 ENERGY_W_GLSB:16 (NOT IMPLEMENTED) ENERGY_W_L:32 ENERGY_W_L_RAW:48 ENERGY_W_Z:64 ENERGY_W:64 FIGURE 5-1: Active Power Signal Path showing Output and Calibration Registers. © 2009 Microchip Technology Inc. CALIBRATION REGISTERS GENERATED THROUGH THIS ROUTINE Equations Section 5.3.3 Section 5.3.3 Section 5.3.5 Section 5.3.7 Section 5.3.3 ...

Page 36

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3 RMS CURRENT, RMS VOLTAGE, APPARENT POWER SIGNAL FLOW AND CALIBRATION 5.3.1 RMS Current, RMS Voltage, and Apparent Power Overview and Signal Path The RMS current and voltage outputs require a two point calibration reading at configurations C1 and C4 ...

Page 37

... Main Flow Chart for Calibration Configuration C1 FIGURE 5-3: Main Calibration Flow Chart. © 2009 Microchip Technology Inc. Meter Calibration Begin Calibration Set MODE1 register bits and LINE_CYC register Put meter in Calibration Configuration C1 (V and I at PF= Enable Calibration Mode by setting bit 0 and 1 of ...

Page 38

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.3 Equations for Configuration C1 Calibration The following equations represent the proper method for calculating the calibration and correction factors after configuration C1. The PC calibration software handles these calculations automatically. The following equations only apply when calibrating a standard phase. ...

Page 39

... The calculation for PHA_VA_GLSB is identical except that it uses the PHA_VA_RAW register instead of PHA_W_RAW: EQUATION 5-8: PHA_VA_GLSB Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations. © 2009 Microchip Technology Inc. Meter Calibration and I B MAX • ...

Page 40

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.4 Configuration C2 Flow Chart - Phase Delay FIGURE 5-4: Configuration C2 Flow Chart. - Phase Delay. DS51884A-page 40 Set MODE1 register bits and LINE_CYC register Put meter in Calibration Configuration C2 (V and I at PF=0. Enable Calibration Mode by setting bit 0 and 1 of ...

Page 41

... EQUATION 5-13: PHA_DELAY Note 1: Convert to 8-bit signed integer for compatibility with PIC18F2520 register and firmware calculations. 2: Since 60 degrees (default) is being subtracted from the measured quantity, the current should lag the voltage under configuration C2. © 2009 Microchip Technology Inc. = PHA_W_RAW @ Configuration PHA_W_RAW @ ...

Page 42

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.6 Configuration C3 Flow Chart - Offset FIGURE 5-5: Configuration C3 Flow Chart - Active Power Offset . DS51884A-page 42 Set MODE1 register bits LINE_CYC register (suggest 256 Line Cycles) Put meter in Calibration Configuration C3 (V and 1/100 I at PF= Enable Calibration Mode ...

Page 43

... LINE_CYC_NUM_2 EQUATION 5-18: PHA_W_OFF Note: Convert to 32-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations The PHA_W_OFF registers hold a signed 32-bit value. However, the math in the microcontroller could overflow for some values near the limits. Limit check the resulting value to make sure the value is between -2,130,706,432 and 2,130,706,431 (inclusive) ...

Page 44

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 5.3.8 Configuration C4 Flow Chart - Mid-Range FIGURE 5-6: Flow Chart for RMS Calibration. DS51884A-page 44 Set MODE1 register bits and LINE_CYC register Put meter in Calibration Configuration C4 (V and 1/ PF= CAL_MODE bit 1 low? YES Read contents of PhA_I_RMS_RAW2 and ...

Page 45

... VR1 EQUATION 5-21: IR2 EQUATION 5-22: VR2 EQUATION 5-23: EQUATION 5-24: EQUATION 5-25: Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations © 2009 Microchip Technology Inc. and I voltages and currents will be 1/10 of the V MIN MIN = PHA_I_RMS_RAW2 @ I ...

Page 46

... EQUATION 5-28: EQUATION 5-29: PHA_I_RMS_GLSB Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations EQUATION 5-30: PHA_V_RMS_GLSB Note: Convert to 16-bit signed integer for compatibility with PIC18F85J90 register and firmware calculations DS51884A-page 46 ⎛ VR1 VR2 – ------------------------------ - ⎝ • ...

Page 47

... TABLE 5-5: Maximum Voltage Less than or Equal To ALL Note that the decimal point location in the reading frame is updated whenever the values are changed. CAL MAX © 2009 Microchip Technology Inc. CURRENT RESOLUTION TABLE LSB Resolution (A) 0.001 0.01 0.1 1 POWER RESOLUTION TABLE ...

Page 48

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design NOTES: DS51884A-page 48 © 2009 Microchip Technology Inc. ...

Page 49

... Appendix A. Schematic and Layouts A.1 INTRODUCTION This appendix contains the following schematics and layouts of the MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design: • Board Schematic - Page 1 • Board Schematic - Page 2 • Board Schematic - Page 3 • Board - Top Layer and Silk-screen • Board - Top Copper • ...

Page 50

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design A.2 BOARD SCHEMATIC - PAGE 1 DS51884A-page 50 © 2009 Microchip Technology Inc. ...

Page 51

... A.3 BOARD SCHEMATIC - PAGE 2 © 2009 Microchip Technology Inc. Schematic and Layouts DS51884A-page 51 ...

Page 52

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design A.4 BOARD SCHEMATIC - PAGE 3 DS51884A-page 52 © 2009 Microchip Technology Inc. ...

Page 53

... A.5 BOARD - TOP LAYER AND SILK-SCREEN MCP3909 / PIC18F85J90 SHUNT METER © 2009 Microchip Technology Inc. Schematic and Layouts DANGER HIGH VOLTAGE DS51884A-page 53 ...

Page 54

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design A.6 BOARD - TOP COPPER DS51884A-page 54 © 2009 Microchip Technology Inc. ...

Page 55

... A.7 BOARD - BOTTOM LAYER AND SILK-SCREEN DANGER HIGH VOLTAGE © 2009 Microchip Technology Inc. Schematic and Layouts DS51884A-page 55 ...

Page 56

... MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design A.8 BOARD - BOTTOM COPPER DS51884A-page 56 © 2009 Microchip Technology Inc. ...

Page 57

... MOV1 VARISTOR 275V RMS 20MM RADIAL Header 2.54mm on center 6 mm/2.5mm Samtec 1 PCB RoHS Compliant Bare PCB, MCP3909/PIC18F85J90 Single Phase Energy Meter Reference Design 10 R1-R10 RES 0.0 OHM 1/8W 5% 0805 SMD 3 R11, R12, R13 RES 4.70K OHM 1/10W 1% 0603 SMD 3 R14, R15, R16 RES 1 ...

Page 58

... Sharp Microelectronics Texas Instruments Inc. National Semiconductor Microchip Technology inc. Microchip Technology Inc. Maxim Abracon™ Corporation ABM3B-10.000MHZ-10-1-U-T Part Number TNPW1206332KBETY MCR10EZHF1001 MCR03EZPFX10R0 RGH2012-2E-P-102-B B3S-1002P PJ-202-30 ® GP1US301XP MCP3909T-I/SS 25LC256-I/SN PC365NJ0000F TPS79133DBVR LM1117MP-5.0/NOPB PIC18F85J90-I/PT MCP130T-270I/TT MAX3323EEUE+ © 2009 Microchip Technology Inc. ...

Page 59

... NOTES: © 2009 Microchip Technology Inc. Bill of Materials DS51884A-page 59 ...

Page 60

... Fax: 886-3-6578-370 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 © 2009 Microchip Technology Inc. EUROPE Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 France - Paris Tel: 33-1-69-53-63-20 ...

Related keywords