CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Lcd interfacing problem with pic16f877a
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
armghan11



Joined: 08 Jan 2013
Posts: 11

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 8:56 am     Reply with quote

Gabriel wrote:
if you can program your pic with a blink LED program then its not a programmer problem.


even a simple led blinking program showing wrong delay with ccs c compiled program. when i burned it using g540
Gabriel



Joined: 03 Aug 2009
Posts: 1085
Location: Panama

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 9:01 am     Reply with quote

did you see my last comment?
_________________
CCS PCM 5.078 & CCS PCH 5.093
armghan11



Joined: 08 Jan 2013
Posts: 11

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 9:18 am     Reply with quote

Gabriel wrote:
did you see my last comment?


yes i did... but why does the same pins working fine when i used mikro c and g540

Code:
sbit LCD_RS at RD6_bit;
sbit LCD_EN at RD7_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISD6_bit;
sbit LCD_EN_Direction at TRISD7_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections

const char character[] = {0,10,31,31,14,4,0,0};

void CustomChar(char pos_row, char pos_char) {
  char i;
    LCD_Cmd(64);
    for (i = 0; i<=7; i++) LCD_Chr_Cp(character[i]);
    LCD_Cmd(_LCD_RETURN_HOME);
    LCD_Chr(pos_row, pos_char, 0);
}

void main(){
  PORTC = 0; //Removes initial value that PIC holds in PORTB
  TRISC = 0;
  Lcd_Init();                        // Initialize LCD
  delay_ms(1000);
  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off


  LCD_Chr(1,4,'I');                  //Write the letter I on the LCD
  CustomChar(1,6);                   //Draw the heart shape on the LCD
  Lcd_Out(1,8,"mikroC");             //Write the word mikroC on the LCD
  PortC= 0b00001000;
  Delay_ms(3000);

}  //  end main
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 10:54 am     Reply with quote

Because you are _not_ 'using the same pins'......

Look at the RS, and EN lines.

Lesson is to read what you type....

Best Wishes
Gabriel



Joined: 03 Aug 2009
Posts: 1085
Location: Panama

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 11:04 am     Reply with quote

yeah... reversed EN and RS pins...

nice catch!

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
armghan11



Joined: 08 Jan 2013
Posts: 11

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 12:06 pm     Reply with quote

Gabriel wrote:
yeah... reversed EN and RS pins...

nice catch!

G.


Well you said problem was with pin B7 and B6 and now you are saying that the reversed EN and RS pins are a problem. I listen properly and I reversed these pin in my ccs c code too but it was not running. Big Fail!
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 1:55 pm     Reply with quote

You are doing yourself no favours.

We only learn you have basic wiring errors, by taking data from other code. This is a basic thing you should have checked for yourself.

Now you post microc code, but no details of the fuses used.

I'm going to guess a number of possible 'disasters' that may exist here:
1) You are actually using a bootloader and have not mentioned this.
2) The fuses used in the microc code bear no resemblance to what you are trying to use in the CCS code.
3) You have never posted your compiler version number. The guidelines were pointed out ages ago.
4) The programmer is not programming the fuses at all, and hence the CCS code doesn't work:
<http://en.pic16.com/mcu/forums61/topic.asp?TOPIC_ID=942>
There are several other threads with this also mentioned.

Best Wishes
Gabriel



Joined: 03 Aug 2009
Posts: 1085
Location: Panama

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 8:59 pm     Reply with quote

..... as my last comment on this thread, i just want to let you know i said that the problem might be that you are using the programing pins on the pic to drive the LCD.... these pins if not properly isolated as PER THE DATASHEET, may cause problems while programing...

OTHER forum members pointed out that you have OTHER hardware issues.....aside from the _POSSIBLE_ diagnosis I gave you. I merely acknowledged their observations.

I don't have your circuit or sufficient information to absolutely tell you what is wrong with you code.


Edit: sigh..

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Gabriel



Joined: 03 Aug 2009
Posts: 1085
Location: Panama

View user's profile Send private message

PostPosted: Sat Mar 02, 2013 9:08 pm     Reply with quote

I actually had to remove part of my previous post.... it wasent very pleasant towards you...

I apologize to anyone who managed to read it before i edited it.
_________________
CCS PCM 5.078 & CCS PCH 5.093
armghan11



Joined: 08 Jan 2013
Posts: 11

View user's profile Send private message

PostPosted: Sun Mar 03, 2013 2:01 am     Reply with quote

Gabriel wrote:
I actually had to remove part of my previous post.... it wasent very pleasant towards you...

I apologize to anyone who managed to read it before i edited it.


i know you and ttelmah doing everything to help me and i am really thankful to both of you ... its just that im upset... it might be a compiler or programmer problem.... im using version 4.114!
armghan11



Joined: 08 Jan 2013
Posts: 11

View user's profile Send private message

PostPosted: Sun Mar 03, 2013 2:10 am     Reply with quote

Ttelmah wrote:
You are doing yourself no favours.

We only learn you have basic wiring errors, by taking data from other code. This is a basic thing you should have checked for yourself.

Now you post microc code, but no details of the fuses used.

I'm going to guess a number of possible 'disasters' that may exist here:
1) You are actually using a bootloader and have not mentioned this.
2) The fuses used in the microc code bear no resemblance to what you are trying to use in the CCS code.
3) You have never posted your compiler version number. The guidelines were pointed out ages ago.
4) The programmer is not programming the fuses at all, and hence the CCS code doesn't work:
<http://en.pic16.com/mcu/forums61/topic.asp?TOPIC_ID=942>
There are several other threads with this also mentioned.

Best Wishes


G540 dont set configuration bits automatically you to do it manually. may be i am not setting them properly.. :(
armghan11



Joined: 08 Jan 2013
Posts: 11

View user's profile Send private message

PostPosted: Thu Mar 07, 2013 11:39 am     Reply with quote

just came to tell you that problem is solved.. the guy from edaboard helped me... it was not a connection problem or coding problem... problem was with the genius programmer..
The software of genius programmer is unable to read properly the HEX file generated by CCS compiler. This a bug in genius software, not in the CCS compiler. The HEX file generated by CCS complier is the hex file of code + hex info for configuration. The hex information of blank is not generated. (Which off course is not required but the software of Genius programmer sees this an error).

Now let me show you how I tackled with that. It simple. Its a two step solution.

1. I converted the hex file generated by CCS compiler to BIN file with HEX2BIN utility then

2. I reconverted the BIN file to HEX file using BIN2HEX utility

the new generated HEX file is now compatible with the software of Genius software which can load the configuration bits automaticaly.

You can download these two small utilities from
HEX2BIN
http://www.keil.com/download/docs/7.asp
BIN2HEX
http://www.keil.com/download/docs/113.asp

you can make a batch file to automate these two steps.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group