• AVR Freaks

Hot!lcd / black vertical bars

Author
aviator3679
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2019/08/22 13:32:23
  • Location: 0
  • Status: offline
2019/08/29 19:31:45 (permalink)
0

lcd / black vertical bars

Hello, Im building a digital thermometer from a youtube tutorial. The simulation on Proteus 8 instead of showing the value from the temperature sensor it shows some black vertical bars all over the lcd screen. Im using the pic18f2580 and mplab x ide v5.25 and xc8 compiler v1.34 and proteus 8 and for lcd the LM016L. The code compiles normally but  the problem is on proteus. The code Im using is:
 
#include <stdio.h>
#include <stdlib.h>
#include "p1.h"

void Initialize_ADC(void);
void Initialize_LCD(void);
void DelayFor18TCY(void);
void DelayPORXLCD(void);
void DelayXLCD(void);
unsigned int ADCResult=0;
float voltage;
unsigned char ResultString[20];
void main(void)
{
OSCCON= 0x76;

Initialize_ADC();
Initialize_LCD();

while(1)
{
ConvertADC();
while(BusyADC());
ADCResult= ReadADC();
voltage= (ADCResult*5.0)/1024;
putrsXLCD("Temp is: ");
sprintf(ResultString, "%f", voltage );
putrsXLCD(ResultString);
putrsXLCD(223);
putrsXLCD("C");
putrsXLCD(" ");
WriteCmdXLCD(0x02);
}
}
void Initialize_ADC(void)
{
OpenADC(ADC_FOSC_2 & ADC_RIGHT_JUST & ADC_2_TAD , ADC_CH0 & ADC_INT_ON & ADC_REF_VDD_VSS, ADC_1ANA);
}
void Initialize_LCD(void)
{
OpenXLCD(FOUR_BIT & LINES_5X7);
while(BusyXLCD());
WriteCmdXLCD(0x06);
WriteCmdXLCD(0x0C);
putrsXLCD("Digital");
SetDDRamAddr(0x40);
putrsXLCD("Thermometer...");
for(int x=0; x<=20; x++)__delay_ms(50);
WriteCmdXLCD(0x01);
}
void DelayFor18TCY(void)
{
Delay10TCYx(20);
}
void DelayPORXLCD(void)
{
Delay1KTCYx(30);
}
void DelayXLCD(void)
{
Delay1KTCYx(10);
}
 
THANK YOU IN ADVANCE !!!!
#1

5 Replies Related Threads

    aviator3679
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2019/08/22 13:32:23
    • Location: 0
    • Status: offline
    Re: lcd / black vertical bars 2019/08/29 20:51:59 (permalink)
    0
    Actually my best guess is that something must be going on in the analogue to digial conversion process. The lcd before the conversion process works just fine and displays "Digital Thermometer...", then again normally " Temp is: ", and then when the value from the sensor should appear on the screen there are some black boxes that appear,no clue,the functions seem alright....
    #2
    ric
    Super Member
    • Total Posts : 24540
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: lcd / black vertical bars 2019/08/29 21:01:08 (permalink)
    0
    I think that LCD library was written for C18, where you have to treat strings in ROM and strings in RAM as different beasts.
    putrsXLCD is short for "Put ROM String XLCD", and there was an equivalent
    putsXLCD for displaying strings in RAM.
     
    Does your library still have both functions? From your reports, the strings that are not working are in RAM, and the ones that do work are in ROM.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #3
    aviator3679
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2019/08/22 13:32:23
    • Location: 0
    • Status: offline
    Re: lcd / black vertical bars 2019/08/29 21:10:55 (permalink)
    0
    You're right as always bro,the entire thing wasn t displaying because i instead of "puts" i was using "putrs"
     
    YOU ARE THE MAN !!!
    #4
    ric
    Super Member
    • Total Posts : 24540
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: lcd / black vertical bars 2019/08/29 21:19:15 (permalink)
    0
    XC8 is much smarter about memory handling than C18, and normally doesn't need anything special to let you lump RAM and ROM strings together.
    Those XLCD ROM functions must be doing something special to force ROM access.
    I suspect if you threw them away and used the RAM versions for everything, your code would get simpler.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #5
    aviator3679
    Starting Member
    • Total Posts : 36
    • Reward points : 0
    • Joined: 2019/08/22 13:32:23
    • Location: 0
    • Status: offline
    Re: lcd / black vertical bars 2019/08/29 23:31:22 (permalink)
    0
    I ll try it from now on,thanks bro!!!
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5