Академический Документы
Профессиональный Документы
Культура Документы
V, I
EQUATION 4: GAIN CALIBRATION
V
CONSTANT
Value for N
ΣV
Voltage is sampled
at these points voltage here is
calculated Cg • d • Id = C • D
k=1 k k
for the current
sampling time
Current is
sampled halfway
between voltages
I
V V
Phase Error
Actual Lag from Phase Error
START
Initialize Initialize
System RAM
(Calibration Routine)
Initialize
Y ADC and I/O Ports
Calibrate now? A
Initialize
Is system Y Load Calibration Data Interrupts
calibrated? from Data EEPROM
Clear SAMPLE
and OFFSET_CNT
Load Default Buffers
Calibration from
Program Memory
Initialize GAIN,
EARTH, REVERSE
and OFFSET Flags
Set RTC for
30 Minute Alarm
Initialize LCD
to Display Power-on
Values from EEPROM
Start Timer0
B A
N Initialize USART
Is kWh flag true?
Y
Send Calibration
Increment kWh Request to GUI
Counter and Store
in EEPROM
Receive Calibration
Data from GUI
N Has display
counter
elapsed?
Y Store Calibration
in Data EEPROM
Has
Display Next N demand timer
Parameter on LCD elapsed?
All data N
Y
received?
Compute Maximum Y
Demand and Store
in Data EEPROM
Disable USART
RETURN
Read OFFSET
Y from ADC,
Is OFFSET true?
Set OFFSET to
False Read Phase
Current (CP)
N
N
Calculate Power
Is Calculate VP
Y Toggle Calibration
Total ≥ 1/3200 and VN from
Pulse and LED V1, V2 and V3
kWh?
N
Calculate Signed
Values for Voltage
Is and Current
Y Set kWh Flag
Total ≥ 0.01 kWh?
to True
Increment
OFFSET_CNT
Accumulate CN and
CP in CACCN
and CACCP Buffers
Is
Y Set OFFSET Integrate Energy
OFFSET_CNT
to True according to EARTH
= 65536?
and REVERSE Flags
N
Are
CN and CP Y Set EARTH Flag
unequal? to True
Is sign
of DECISION Y Toggle REVERSE
negative? Flag
Does
current exceed Y Set Amplifier Gain
high limit? to Low
Is
Y Set Amplifier Gain
current below
to High
low limit?
Is
Y Clear Buffer
integrated energy
very low?
Clear DECISION
and Current
Buffers
Return to ISR
2
Serial Port
Control from Firmware
Calibration
Jumper
VCC
32 kHz
33 pF
33 pF
C8
VSS
VDD
.01 μF
VCC
VCC
VCC
VCC
VCC
VCC
PIC16F873A
VSS
VSS
33 pF
10K
VCC
.01 μF
VCC
14
1
8
A
D
B
C
12
13
10
3
9
VCC
VCC
9
8
B
VCC-
VCC
4
A
C
1
6
8
680 pF
VCC
VCC
.01 μF
VCC
AC
5
4
B
3
10
2
B
B
C
A
C
A
13
11
12
1
33 pF
1000 μF
VCC
.1 μF
1 μF
.1 μF
1000 μF
VCC-
22 nF
OPTIONAL
1 μF
230V, 50 Hz AC
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
10/20/04