PIC ile akım ölçümü watt hour meter pic16c923 cs5460

| Mayıs 28, 2023 Tarihinde güncellendi
PIC ile akım ölçümü watt hour meter pic16c923 cs5460

Akım ölçüm devresi PIC16C923 ve CS5460 entegreleri üzerine kurulu 120V ya da 220V, 50Hz, 60Hz. voltaj frekans aralıklarında ölçüm yapabiliyor LCD göstergesi ve kontrol butonları bulunuyor

PCBway Türkiye PCB Manufacturer PCB Assembly

Akım ölçümünde akım trafosu kullanılmış trafodan alınan bilgiler sistem üzerinde işleniyor. Protel le hazırlanmış pcb, şema dosyaları assembly ile hazırlanan yazılım dosyaları var

Projenin kaynağı Microchip en ince detaylara kadar açıklama var (ingilizce) farklı projeleriniz için iyi bir kaynak olabilir feyz verebilir.

watt_mtr.asm yazılım içeriği

	list	st=off	; suppress list file symbol table
	list	n=0	; suppress list file page breaks
; Configuration switches. These control what code is assembled.

;   Select the desired operating voltage by commenting out all but
;   the desired voltage range
	#define	VOLT120	; 120V nominal full scale range
;	#define	VOLT220	; 220V nominal full scale range

;   Selects the real time clock frequency source,
;	#define	TMR1OSC	; defined if using 32kHz T1OSC, comment out if another RTC source

; Software License Agreement
; The software supplied herewith by Microchip Technology Incorporated (the
; "Company") for its PICmicro® Microcontroller is intended and supplied to
; you, the Company's customer, for use solely and exclusively on Microchip
; PICmicro Microcontroller products.
; The software is owned by the Company and/or its supplier, and is protected
; under applicable copyright laws. All rights are reserved. Any use in
; violation of the foregoing restrictions may subject the user to criminal
; sanctions under applicable laws, as well as to civil liability for the
; breach of the terms and conditions of this license.

; Author: Stephen Humberd, Brett Duane
; Company: Microchip Technology Inc.
; Revision: 1.1
; Date: 5-15-2000
; Assembled using MPLAB 4.99.07, MPASM 2.30.11
; Include Files: CAL.INC      calibration constants
;                PR3.INC      LCD segment definitions
;                P16C924.INC  Standard Microchip include file for PIC16C923/924
; This program controls and reads data from The Crystal CS4560
; Single Phase Bi-Directional Power/Energy IC
; and displays it on a eight digit LCD using the LCD drive
; function of a PIC16C923.

; The CS5460 measures line voltage and current transfered between
; the line (source) and the load. The instantanious voltage and current
; measurements are used to compute (within the CS5460) instantanious power,
; RMS voltage, RMS current, and accumulated energy. All of these
; measurements and calculation results are avalible to the PIC16C923 via SPI.
; The RMS voltage and RMS current are displayed and used to calculate aparent
; power.
; A pulse output (EOUT) on the CS5460 indicates when a programable amout of
; energy has been transferred between the line and the load. Another output
; (EDIR) indicates the direction of that transfer (if a load is highly
; reactive, enegry flows from the load to the line). These pulses are counted
; by the PIC16C923 to measure and display total energy transferred in WattHours
; True power is measured by counting pulses for 1 second. The CS5460 has been
; programmed to generate a pulse for each 10WattSeconds of energy tranferred.
; The pulse count is multiplied by 10 to calculate true power.
; Aparent power and true power are displayed, and are used to calculate the
; power factor of the load.
; The CS4560 outputs a 4.096MHz clock for use by the PIC16C923 as the system
; clock. This code offers the option of using this source as the real time clock
; source with CCP1 in compare/interrupt only/special event mode, or using the Timer1
; oscillator with a 32.768KHz crystal. The hardware provided on the demo units
; supports both options.
; Every 8 minutes, the current accumulated energy (WHr) is written to the 24C01
; serial EEPROM. This saves the total energy during times when the AC power is removed.
; Calibration constants are also stored in the 24C01. These are read from the 24C01
; and written back to the CS5460 when power is reapplied, and when the total enegy is
; cleared from the 24C01. The code to read the constants from cal.inc and write them to
; the 24C01 has been included, but has been commented out.
; On reset, the PIC16C923 checks the 4 control buttons for 3 specific states. One state
; allows the user to set the time of the real time clock. Another state clears the
; total WHr for the 24C01 and rewrites the calibration constants to the CS5460. A
; third state allows the user to adjust the calibration constants in the CS5460.
; Written by Stephen Humberd, Microchip Technology 10/08/1999
; Optional Real Time Clock sources (T1OSC or CS5460 CPUCLK output)
; Monitor CS5460 !EDIR output.
; Change Pulse Rate from 128 pulses/KWHr (1 pulse/28,125Wsec)
;    to 1 pulse/10Wsec (100W load generates 10 pulses per second)
; Use 16-bits of CS5460 data rather than 24-bits
;    (CS5460 settings are still 24-bits long)
; Added Apparent Power, True Power, and Power Factor Functions.
; Moved Pulse Rate register value to EEPROM.
; Modified Calibrate routine to include Pulse Rate "Gain" function.
; General code size reduction. (Fits in PIC16C923.)
; If the CPUCLK output of the CS5460 is 4.096MHz, the CCP1 module
; can be used (as is) for the real time clock reference instead of the
; Timer1 Oscillator. If the CPUCLK output is some other frequency,
; CCPR1H:CCPR1L will need to be adjusted to make CCP1 generate an interrupt
; every 0.5 second.
; If the Timer1 oscillator is to be used as the Real Time Clock base,
; uncomment line 46 ("#define TMR1OSC"). This causes CCP1 code to
; be disabled and T1OSC code to be enabled.
; Modified by Brett Duane, Microchip Technology 5/25/2000

OVERVIEW: This application note shows how to use a PIC16C923 microcontroller to control operation of the CS5460 power measurement integrated circuit from Cirrus Logic®/Crystal Power Measurement, to drive a liquid crystal panel (“glass”), and to store and retrieve data using the 24C01 Serial EEPROM.

Energy transferred between the line and load is measured by the CS5460. The PIC16C923 initializes the CS5460 with calibration data stored in the 24C01 Serial EEPROM, records the total energy measured in the 24C01, and displays results on the LCD panel.

INTRODUCTION: Most forms of AC power measurement have already been patented by various companies, so measuring AC power in a product intended for sale often involves
paying licensing fees to another company. The CS5460 offers an integrated solution that provides a power and energy measurement sub-system, requiring only voltage and current sense inputs. In addition, calibration is accurate for any current waveform or power factor that may be encountered. By using the CS5460, a PIC16C923 microcontroller, a 24C01 Serial EEPROM, and an LCD panel, a simple and compact device is constructed that displays RMS voltage, RMS current, and the energy consumed by a load. These features are extended by including computation and display of apparent power, true power,
and power factor.

The PIC16C923 LCD controller can drive an LCD panel with up to 4 common planes and up to 32 segments. 4K words of program memory, and 176 bytes of RAM are provided. A Synchronous Serial Peripheral (SSP) provides SPITM communications with the CS5460. Inter-Integrated CircuitTM (I2C) communications with the 24C01 Serial EEPROM are provided by firmware. The CS5460 power/energy measurement IC measures instantaneous voltage and current four thousand times a second and uses these measurements to compute VRMS, IRMS, instantaneous power, and accumulated energy results for read out. In addition, a pulse is generated whenever a user specified amount of energy transfers between the line and the load.


Şifre-Pass: 320volt.com

Yayım tarihi: 2009/11/15 Etiketler: , , , , , ,

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir