FFu4a3W

Voltmeter and Ammeter

 
Overview
Project Introduction:
Digital Voltage and Current Meter Based on CW32.
Project Function:
The digital voltage and current meter combines ADC technology with circuit measurement principles, accurately converting analog voltage and current signals into digital displays. This allows electronic engineers to intuitively read and analyze
project parameters.

This project uses the LCSC CW32F030C8T6 development board (core board) as the main controller
and uses a digital tube to display voltage and current values.

Principle Analysis (Hardware Description)
: Here you can fill in the design principle of the project, breaking down and analyzing the design principle. Example:
This project consists of the following parts: power supply, digital tube display, main control, and voltage and current sampling. This project mainly samples voltage and current through an ADC and displays it using a digital tube.
Power supply circuit:
Digital tube display circuit
...
Software
code for digital tube display, controlling the lower 8 bits of GPIO to display on the 8-segment digital tube:
void Seg_Display(uint8_t Pos,uint8_t Num)
{
int i;
uint8_t Dis_Value = Seg_Table[Num];

GPIO_LowByte_Write(CW_GPIOA,Dis_Value);


switch(Pos)
{
case 0:
GPIO_WritePin(CW_GPIOA,GPIO_PIN_8,GPIO_Pin_RESET); //PA8,COM1
break;
case 1:
GPIO_WritePin(CW_GPIOA,GPIO_PIN_11,GPIO_Pin_RESET); //PA9,COM2
break;
case 2:
GPIO_WritePin(CW_GPIOA,GPIO_PIN_12,GPIO_Pin_RESET); //PA10,COM3
break;
case 3:
GPIO_WritePin(CW_GPIOA,GPIO_PIN_15,GPIO_Pin_RESET); //PA11,COM4
break;
case 4:
GPIO_WritePin(CW_GPIOB,GPIO_PIN_3,GPIO_Pin_RESET); //PA12,COM5
break;
case 5:
GPIO_WritePin(CW_GPIOB,GPIO_PIN_4,GPIO_Pin_RESET); //PA15,COM6
break;
default:
break;
}
}

Voltage and current acquisition:
void Volt_Cal(void)
{
float t,KT1;
V_Buffer = Mean_Value_Filter(Volt_Buffer,ADC_SAMPLE_SIZE);//Use mean filtering
I_Buffer = Mean_Value_Filter(Curr_Buffer,ADC_SAMPLE_SIZE); //Use mean filtering
V_Buffer = (V_Buffer * ADC_REF_VALUE >> 12) * (R2 + R1)/R1;
// Rounding
if(V_Buffer % 10 >= 5)
{
V_Buffer = V_Buffer / 10 + 1;
}
else
{
V_Buffer = V_Buffer / 10;
}
ADC_GetSqr1Result(&I_Buffer); ///Display the current acquired value
I_Buffer=I_Buffer * ADC_REF_VALUE >> 12;

/**mv =I_Buffer * ADC_REF_VALUE >> 12,
R = 100mr,
10ma = mv/R/10=mv/0.1/10 = mv
*/
}
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-26 13:26:14

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号