ide wont accept hex file of kiel

Thread Starter

corefinder

Joined Oct 6, 2011
55
Hi I was working with interfacing of lcd(JHD162a) 16*2 type with at89s52 micro controller. So I tried making program in keil c51 compiler. I compiled the code and generated hex file from it. I tested hex file in proteus simulator and it was running fine, lcd was showing data. I have 8051 Ide bought. It has a usb ISP programmer. But the IDE wont take the hex file. It does not load the hex file by only keil. It would load correctly the hex file of compiler microC pro of 8051 but it wont run on lcd.
 

Ian Rogers

Joined Dec 12, 2012
1,136
Have you a link to the IDE you purchased.... The hex file could be the wrong format.... You can get convertor files... I need to see your hex file...
 

Thread Starter

corefinder

Joined Oct 6, 2011
55
Program code:
Rich (BB code):
#include<reg52.h> //including sfr registers for ports of the controller
#include<lcd.h> //Can be download from bottom of this article

//LCD Module Connections
sbit RS = P2^0;
sbit EN = P2^1;
sbit D4 = P2^4;
sbit D5 = P2^5;
sbit D6 = P2^6;
sbit D7 = P2^7;
//End LCD Module Connections
void Delay(int a)
{
  int j;
  int i;
  for(i=0;i<a;i++)
  {
    for(j=0;j<100;j++)
    {
    }
  }
}
void main()
{
  int i;
  Lcd4_Init();
  while(1)
  {
    Lcd4_Set_Cursor(1,1);
    Lcd4_Write_String("electroSome LCD Hello World");
    for(i=0;i<15;i++)
    {
      Delay(1000);
      Lcd4_Shift_Left();
    }
    for(i=0;i<15;i++)
    {
      Delay(1000);
      Lcd4_Shift_Right();
    }
    Lcd4_Clear();
    Lcd4_Set_Cursor(2,1);
    Lcd4_Write_Char('e');
    Lcd4_Write_Char('S');
    Delay(2000);
  }
}
 

Attachments

Ian Rogers

Joined Dec 12, 2012
1,136
They are both genuine hex files... However I think the issue is in the keil compiler.

The addresses used on the kiel compiler are very high..... Whereas the microc start were I'd expect!!
 

Thread Starter

corefinder

Joined Oct 6, 2011
55
I dont understand this. Actually the bigger problem is that the hex file by microc is running ok in proteus and also burning on microcontroller but i dont see anything on lcd. So I dont if the problem is in lcd or the code so I thought of using keil to check if something is displayed on lcd.
I want to know another thing that hex code by micro c is running perfectly on simulator,i.e, lcd is displaying but actual lcd is blank? What could be the reason?
 

Ian Rogers

Joined Dec 12, 2012
1,136
After disassembling the mikroC example D4~7 are on pins P2.2 ~ P2.5... Where you are using P2.4 ~ P2.7...

See if you have options to make 16 bit or 8 bit hex files....
 

ErnieM

Joined Apr 24, 2011
8,377
I dont if the problem is in lcd or the code so I thought of using keil to check if something is displayed on lcd.
The HUGE advantage of buying s development board such as yours means you can assume the hardware is correct.

Sure, anyone can ship a dog on occasion, but the odds are in your favor here.

I want to know another thing that hex code by micro c is running perfectly on simulator,i.e, lcd is displaying but actual lcd is blank? What could be the reason?
A simulator cannot check everything, timing is usually one of those things. Your real hardware may be running much fasted then the simulation so the LCD never has time to respond. I don't use those micros, but with other types you can completely mess up certain configuration settings that a simulator cannot simulate so your code seems to work but...

I'd advise taking a step back: getting a full LCD to work is tough so do something simple and easy first like get a LED to blink on and off: it's a great hardware check and confidence builder.
 
Top