xpress_embedo
Advanced Member level 4
- Joined
- Jul 5, 2011
- Messages
- 1,154
- Helped
- 161
- Reputation
- 396
- Reaction score
- 189
- Trophy points
- 1,353
- Location
- India
- Activity points
- 10,591
Hello!! i am using MPLAB X with MPLAB C18 v3.40 Compiler and using PIC18F27J53 Micro-Controller.
I want to remove these warnings, i am getting
I had Written a simple LCD Program, to display data on LCD, and now wants to make a function, with which i can pass the first address of the array and it displays whole string.
For example:-
unsigned char text[] = "EDA BOARD";
and
Lcd_Text(text);
will display it on LCD, i had done it but getting a warning in this, pls help me to correct it.
This is my Code
I am getting both warning in this code.
Please suggest me something to solve this warning issue.
Although my code is working fine as expected, just want to remove this compiler warning
I want to remove these warnings, i am getting
Code:
Warning [2054] suspicious pointer conversion
and
Warning [2066] type qualifier mismatch in assignment
I had Written a simple LCD Program, to display data on LCD, and now wants to make a function, with which i can pass the first address of the array and it displays whole string.
For example:-
unsigned char text[] = "EDA BOARD";
and
Lcd_Text(text);
will display it on LCD, i had done it but getting a warning in this, pls help me to correct it.
This is my Code
Code:
#include <p18F27J53.h>
#include <delays.h>
#include <string.h>
/******************CONFIGURATION BITS****************/
#pragma config WDTEN = OFF //WDT disabled (enabled by SWDTEN bit)
#pragma config PLLDIV = 5 //Divide by 5 (20 MHz oscillator input)
#pragma config STVREN = ON //stack overflow/underflow reset enabled
#pragma config XINST = OFF //Extended instruction set disabled
#pragma config CPUDIV = OSC1 //No CPU system clock divide
#pragma config CP0 = OFF //Program memory is not code-protected
#pragma config OSC = HSPLL //HS oscillator, PLL enabled, HSPLL used by USB
#pragma config FCMEN = OFF //Fail-Safe Clock Monitor disabled
#pragma config IESO = OFF //Two-Speed Start-up disabled
#pragma config WDTPS = 32768 //1:32768
#pragma config DSWDTOSC = INTOSCREF //DSWDT uses INTOSC/INTRC as clock
#pragma config RTCOSC = T1OSCREF //RTCC uses T1OSC/T1CKI as clock
#pragma config DSBOREN = OFF //Zero-Power BOR disabled in Deep Sleep
#pragma config DSWDTEN = OFF //Disabled
#pragma config DSWDTPS = 8192 //1:8,192 (8.5 seconds)
#pragma config IOL1WAY = OFF //IOLOCK bit can be set and cleared
#pragma config MSSP7B_EN = MSK7 //7 Bit address masking
#pragma config WPFP = PAGE_1 //Write Protect Program Flash Page 0
#pragma config WPEND = PAGE_0 //Start protection at page 0
#pragma config WPCFG = OFF //Write/Erase last page protect Disabled
#pragma config WPDIS = OFF //WPFP[5:0], WPEND, and WPCFG bits ignored
#pragma config CFGPLLEN = OFF
/****************************************************/
/****************PIN DETAILS****************/
#define LCD_RS PORTCbits.RC0
#define LCD_RW PORTCbits.RC1
#define LCD_EN PORTCbits.RC2
#define LCD_DATA PORTB
#define CURSOR_OFF 0x0C
#define LCD_CLEAR 0x01
#define FIRST_ROW 0x80
#define SECOND_ROW 0xC0
/*******************************************/
/******************FUNCTION PROTOTYPE*******************/
void Delay_ms(unsigned int itime);
void Lcd_Init(void);
void Lcd_Cmd(unsigned char value);
void Lcd_Data(unsigned char value);
void Lcd_Text(unsigned char *msg);
/*******************************************************/
rom unsigned char text[] = "EDA BOARD";
void main()
{
Lcd_Init();
Lcd_Text(text);
while(1);
}
/******************FUNCTION PROTOTYPE*******************/
void Delay_ms(unsigned int itime)
{
#ifndef __DELAY_IN_SEC
#define __DELAY_IN_SEC
unsigned int first;
unsigned int second;
#endif
for(first=0;first<itime;first++)
{
for(second=0;second<650;second++)
{
Delay1TCY();
}
}
}
void Lcd_Cmd(unsigned char value)
{
LCD_DATA = value;
LCD_RS = 0;
LCD_RW = 0;
LCD_EN = 1;
Delay_ms(2);
LCD_EN = 0;
Delay_ms(1);
}
void Lcd_Data(unsigned char value)
{
LCD_DATA = value;
LCD_RS = 1;
LCD_RW = 0;
LCD_EN = 1;
Delay_ms(2);
LCD_EN = 0;
Delay_ms(1);
}
void Lcd_Init(void)
{
TRISB = 0x00;
TRISCbits.TRISC0 = 0;
TRISCbits.TRISC1 = 0;
TRISCbits.TRISC2 = 0;
Lcd_Cmd(0x38); //Lcd_Initialize
Delay_ms(10);
Lcd_Cmd(CURSOR_OFF);
Delay_ms(10);
Lcd_Cmd(LCD_CLEAR);
Delay_ms(10);
Lcd_Cmd(FIRST_ROW);
Delay_ms(5);
}
void Lcd_Text(unsigned char *msg)
{
#ifndef _LCD_STRING_LEN
#define _LCD_STRING_LEN
unsigned char len;
unsigned char pointer;
#endif
len = strlen(msg);
for(pointer=0;pointer<len;pointer++)
{
Lcd_Data(msg[pointer]);
}
}
/*******************************************************/
I am getting both warning in this code.
Please suggest me something to solve this warning issue.
Although my code is working fine as expected, just want to remove this compiler warning