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.

[SOLVED] In 16x2 LCD, how to refresh the values at point only other value remains stable

Status
Not open for further replies.
Re: In 16x2 Lcd ,how to refresh the values at point only other value remains stable

Sorry , I am posting the code here where i need to implement the technique or code as i asked my first post . I didint used that technique here because i use another code to test it .And i posted above .

Code:
/* 
 * File:   adc_main.c
 * Author: Krishna
 *
 * Created on September 27, 2015, 6:24 AM
 */


// PIC16F877 Configuration Bit Settings

// 'C' source line config statements

#include <xc.h>
#include"lcd.h"
#include"adc.h"
#include <stdlib.h>
#define _XTAL_FREQ 20000000 // 20Mh
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

// CONFIG
#pragma config FOSC = HS        // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF      // Power-up Timer Enable bit (PWRT disabled)
#pragma config CP = OFF         // FLASH Program Memory Code Protection bits (Code protection off)
#pragma config BOREN = ON       // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF        // Low Voltage In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF        // Data EE Memory Code Protection (Code Protection off)
#pragma config WRT = OFF        // FLASH Program Memory Write Enable (Unprotected program memory may not be written to by EECON control)


void main()
{   unsigned char volt[5] ,current[5];
    int v,i;
    TRISB = 0X00;  // output for the 8 bit
    TRISA =0XFF;
    int adc_value=0x00;
    unsigned char digits[5];
    lcd_init();   // lcd initialization
    adc_init();   // adc initialization
   
    string("gElectron ");
        
    while(1)

    {
      LINE2;
    
      CLEAR
    //while(1)

    //{
   v =   read_adc(0);  // reading voltage
   i =   read_adc(1);  // reading voltage for current
   v = (v * 4.89 * 2.4)/10;
   i = (i * 2.92);
   i = ((i*4.89)/0.47)/10;



   if(v< 1200)
   {
   volt[0] = ((v /1000)%10)+0x30;
   volt[1] = ((v /100) % 10) + 0x30;
   volt[2] = '.';
   volt[3] = ((v/ 10) %10) + 0x30;
   volt[4] = (v % 10) + 0x30 ;


   string("Volt    : ");
   for(int i =0; i<5;i++)
  lcd_data(volt[i]); // just displaying ADC value
  string("V");
  }
  else
  {

   string("Over Voltage");
    }
    LINE2;
    if(i<3100)
    {
    current[0] =((i /1000)%10)+0x30;
    current[1] = '.';
    current[2] = ((i /100) % 10) + 0x30;
    current[3] = ((i/ 10) %10) + 0x30;
    string("Current : ");
    for(int i =0; i<4;i++)
    lcd_data(current[i]);
    string("A");

    }
    else
    {

        string("Over Current");
    }
    __delay_ms(600);
    CLEAR
    }


    }


the whole project is uploaded here.

Also notyfy any better way to do the whole program efficiently
 

Attachments

  • adc_lcd.rar
    292.5 KB · Views: 58
Last edited:

Re: In 16x2 Lcd ,how to refresh the values at point only other value remains stable

The problem is Watch Dog Timer is resetting the PIC and hence you see the blinking. Use #pragma directive and turn OFF WDT.
 

Re: In 16x2 Lcd ,how to refresh the values at point only other value remains stable

How can i Rectify it .

 
Last edited:

Re: In 16x2 Lcd ,how to refresh the values at point only other value remains stable

Here is the fixed code. You were calling CLEAR inside the while(1) loop and this was erasing the LCD and

Code:
string(Volt     :");

and

Code:
string(Current :");

were being written in while(1) loop repeateadly and this was causing the LCD to refresh and appear as blinking.
 

Attachments

  • adc_lcd_fixed.rar
    153.6 KB · Views: 53

Re: In 16x2 Lcd ,how to refresh the values at point only other value remains stable

Thanks for the Help . learned a lot of .
I have a doubt .

Can i scroll a single text on lcd which at cursor position for example 0x8A after this location has a text (ie over voltage )
can i scroll this text from right to left and the letter will loss at 0x8A .

May i ask it in another thread .?
 
Last edited:

Re: In 16x2 Lcd ,how to refresh the values at point only other value remains stable

Hi,

scrolling: I dont think it is possible with the display´s instructions.

So you have to generate this with software.
For such display functions I recommend to store the data for the two lines in your microcontroller. Maybe as two arrays of 16 bytes.
So you can all the functions in your microcontroller and when you are finished you just transfer both lines completely to the LCD.

May i ask it in another thread .?
If you need further assistance on this, then yes.


Klaus
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top