Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[moved] 230 ac voltage measuring by dspic30f2010 and lcd

Status
Not open for further replies.

hareeshchamiyar

Newbie level 4
Newbie level 4
Joined
Mar 12, 2018
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
45
am trying to make a project for 230 ac voltage measuring by dspic30f2010 and lcd.but didn't get the output on my bread board.am using mikroc pro.and the lcd is 16x1.
please anyone help me.
here is my program

Code:
// LCD module connections
sbit LCD_RS at LATD0_bit;
sbit LCD_EN at LATD1_bit;
sbit LCD_D4 at LATE0_bit;
sbit LCD_D5 at LATE1_bit;
sbit LCD_D6 at LATE2_bit;
sbit LCD_D7 at LATE3_bit;

sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISE0_bit;
sbit LCD_D5_Direction at TRISE1_bit;
sbit LCD_D6_Direction at TRISE2_bit;
sbit LCD_D7_Direction at TRISE3_bit;
// End LCD module connections

unsigned char ch;
unsigned int adc_rd;
char *text;
long tlong;

void main() {
  ADPCFG = 0xFFFF;
  TRISB = 0xFF; // PORTB is input
  Lcd_Init();
  LCD_Cmd(_LCD_CURSOR_OFF);                 // send command to LCD (cursor off)
  LCD_Cmd(_LCD_CLEAR);                      // send command  to LCD (clear LCD)

  text = "AUREEMAS";               // assign text to string
  LCD_Out(1,1,text);                       // print string a on LCD, 1st row, 1st column
  Delay_ms(2000);
  LCD_Cmd(_LCD_CLEAR);
  text = "VOLTAGE";                    // assign text to string
  LCD_Out(1,1,text);                       // print string a on LCD, 2nd row, 1st column
  Delay_ms(2000);
  LCD_Cmd(_LCD_CLEAR);
  text  = "V:";                      // assign text to string
  while (1) {
    adc_rd  = ADC1_read(1);                 // get ADC value from 2nd channel
    LCD_Out(1,1,text);                     // print string a on LCD, 2nd row, 1st column
    tlong = (long)adc_rd * 5000;           // covert adc reading to milivolts
    tlong = tlong / 4011;                  // 0..1023 -> 0-5000mV

    ch     = tlong / 1000;                 // extract volts digit
    LCD_Chr(1,3,48+ch);                    // write ASCII digit at 2nd row, 9th column
    LCD_Chr_CP('.');

    ch    = (tlong / 100) % 10;            // extract 0.1 volts digit
    LCD_Chr_CP(48+ch);                     // write ASCII digit at cursor point

    ch    = (tlong / 10) % 10;             // extract 0.01 volts digit
    LCD_Chr_CP(48+ch);                     // write ASCII digit at cursor point
    
    LCD_Chr_CP('V');

    Delay_ms(1);
  }
}
 
Last edited by a moderator:

Hi,

Please give a detailed error description.
Tell us what you want to achieve and how you want to achieve this.
Tell us what you expect and what you see instead.
Tell us what you did to debug the problem.

Additionally you should post your schematic.

***
In detail you speak about a 230V AC signal, but you treat it like a 0..5V DC signal.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top