#include <p18F8680.h>
#include <delays.h>
#include <string.h>
#include <stdio.h>
#include "LCD_Utilities.h"

    int* lpc_L1;
    unsigned int ln_Volts;
    unsigned int ln_Tenths;
    unsigned char luc_Result;

char Convert_ADCResult_to_Char(unsigned char, unsigned char);

void main (void)

    TRISA = 0x01;
    TRISD = 0x00;
    ADCON0 = 0x01;  // ch0, DONE, ADC on
    ADCON1 = 0x0E;  // AN0 set to analog, all others are digital
    ADCON2 = 0xA6;  // right justified, 8TAD, FOSC/64

    while (1)  
    { // data reading forever
        ADCON0bits.GO_DONE = 1; // Start conversion
        while (ADCON0bits.GO_DONE == 1); // wait until done

        luc_Result = ~Convert_ADCResult_to_Char (ADRESH, ADRESL);
        PORTD = ~Convert_ADCResult_to_Char (ADRESH, ADRESL);
        ln_Volts = luc_Result / 204;
        ln_Tenths = luc_Result % 20;

        Delay10KTCYx (200); // delay 250 milliseconds
        ADCON1 = 0x0F;          // configure port for use with digital
        LCD_init ();            // initialize LCD
        LCD_cmd (0x80);         // set cursor to row 1 and column 1

        sprintf (lpc_L1,(const far rom int*) " %d.d volt F", ln_Volts, ln_Tenths);
    //  LCD_putstr ((rom char *) ln_Volts); // output the message lac_Line1 to LCD


char Convert_ADCResult_to_Char (unsigned char ADC_high, unsigned char ADC_low)
unsigned int ADCResult;
ADCResult = ADC_high;
ADCResult = ADCResult << 8; // shift upper bits to left
ADCResult = ADCResult | ADC_low; // all highs transfer
ADCResult = ADCResult / 4;  // convert from 10 bit to 8 bit

return ADCResult;


Working with a PIC18f8680 Micro. Using the MPLAB v8.92 IDE.
I am having issues with getting the value ln_Volts and ln_Tenths to print to the LCD.
the latest error is c:39:Warning [2054] suspicious pointer conversion.

Why are you trying to cast a string to an int pointer on that line? That is indeed suspicious.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.