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 support@ccsinfo.com

Need Help for HD44780 Programming with PIC16F876A
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

Enalbe & RS config not working on pins B6 & B7
PostPosted: Wed Jan 17, 2007 4:06 pm     Reply with quote

ERm, somehow when I try and use pins B6 & B7 as the RS and Enable pins, nothing happens... Question Y is this so?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 4:13 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=29476&highlight=debugger+pins
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 4:36 pm     Reply with quote

Tks for the insight PCM Programmer....You're always as helpful all the time...I'll try other pins...

PCM programmer wrote:
http://www.ccsinfo.com/forum/viewtopic.php?t=29476&highlight=debugger+pins
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 5:06 pm     Reply with quote

I've used the following codes in flex_lcd.c and my main program. Thing is I think there is some addressing problem here...For this section of my code
Code:

printf(lcd_putc, "System Normal\n..........");


The word "System Normal" seems to have shifted left by 5 characters. and so only the words "m Normal" appears on my LCD. Please advise...

davekelly wrote:
In FlexLCD.c I have the following defines:

Code:

// Display ON/OFF Control defines
#define CLEAR_DISPLAY      0b00000001  // addition


Then you can use

Code:

/////////////////////////////////////////////////////////////////////////
/// Completely clear the contents of the display
/////////////////////////////////////////////////////////////////////////

void ClearDisplay (void)
{
   lcd_send_byte (0, 0x80);     // Set memory to first line
   lcd_send_byte (0, CLEAR_DISPLAY);
   lcd_send_byte (0, 0xc0);     // 'Second' line
   lcd_send_byte (0, CLEAR_DISPLAY);
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 5:22 pm     Reply with quote

I'm not sure what the purpose of his code is. The Flex LCD driver
(and the CCS driver) already has a "clear screen" command in it.
It's the \f command. Also notice that it takes a while for this command
to be executed by the LCD. The driver (see below) has a 2 ms delay
in it, to allow time for the command to finish. In his code, he doesn't
have any delay. As a consequence, when you tried to send a string
of text, the "clear screen" command was still in progress and the
first part of your text was ignored. I didn't say anything at the time,
but I recommend that you ignore his post.

See the \f command below:
Code:

//-----------------------------
void lcd_putc(char c)
{
 switch(c)
   {
    case '\f':    // Clear the LCD screen
      lcd_send_byte(0,1);
      delay_ms(2);
      break;
   
    case '\n':
       lcd_gotoxy(1,2);
       break;
   
    case '\b':
       lcd_send_byte(0,0x10);
       break;
   
    default:
       lcd_send_byte(1,c);
       break;
   }
}
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 5:30 pm     Reply with quote

Ok.....So does that mean I can call a function cleardisplay() and include the following:

Code:

cleardisplay();
{
     lcd_send_byte(0,1);
     delay_ms(2);
}


Btw, if I need to burn the program into the PIC, do i need to use any special commands like #write eeprom or do I just use the normal method (Programmer --> Enable Programmer --> Erase device --> Program device)???

PCM programmer wrote:
I'm not sure what the purpose of his code is. The Flex LCD driver
(and the CCS driver) already has a "clear screen" command in it.
It's the \f command. Also notice that it takes a while for this command
to be executed by the LCD. The driver (see below) has a 2 ms delay
in it, to allow time for the command to finish. In his code, he doesn't
have any delay. As a consequence, when you tried to send a string
of text, the "clear screen" command was still in progress and the
first part of your text was ignored. I didn't say anything at the time,
but I recommend that you ignore his post.

See the \f command below:
Code:

//-----------------------------
void lcd_putc(char c)
{
 switch(c)
   {
    case '\f':    // Clear the LCD screen
      lcd_send_byte(0,1);
      delay_ms(2);
      break;
   
    case '\n':
       lcd_gotoxy(1,2);
       break;
   
    case '\b':
       lcd_send_byte(0,0x10);
       break;
   
    default:
       lcd_send_byte(1,c);
       break;
   }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 5:41 pm     Reply with quote

Just do this:
Code:

lcd_putc('\f'); // Clear the screen

or
Code:

// Clear the screen and display "Hello World".
lcd_putc("\fHello World");

----------------
Regarding the programmer question, it all depends upon what
programmer you have. Each programmer will come with its
own instructions on how to operate it. I don't know which one
you have. I have ICD2 and PicStart-Plus.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 6:29 pm     Reply with quote

Yes...I'm using ICD2 and PICDem2 Plus Dev Board...Thing is I want to just flash my program into the PIC and let it run by itself on the breadboard with all the connections.

I'm currently using PIC16F876A. is this possible?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 17, 2007 6:57 pm     Reply with quote

I'm not sure what you mean by "all the connections".

This thread has detailed instructions on programming a board so
it will run a program in standalone mode. This means you can
remove the ICD2 from the board after you program it.
http://www.ccsinfo.com/forum/viewtopic.php?t=21415
davekelly



Joined: 04 Oct 2006
Posts: 53
Location: Berkshire, England

View user's profile Send private message

PostPosted: Thu Jan 18, 2007 2:30 am     Reply with quote

PCM programmer wrote:
I'm not sure what the purpose of his code is. The Flex LCD driver
(and the CCS driver) already has a "clear screen" command in it.
It's the \f command. Also notice that it takes a while for this command
to be executed by the LCD. The driver (see below) has a 2 ms delay
in it, to allow time for the command to finish. In his code, he doesn't
have any delay. As a consequence, when you tried to send a string
of text, the "clear screen" command was still in progress and the
first part of your text was ignored. I didn't say anything at the time,
but I recommend that you ignore his post.


Sorry. My code was customized to work with the 16x1 display, which has a few peculiarities.
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Mon Jan 22, 2007 4:08 am     Reply with quote

Cheers:)

PCM programmer wrote:
I'm not sure what you mean by "all the connections".

This thread has detailed instructions on programming a board so
it will run a program in standalone mode. This means you can
remove the ICD2 from the board after you program it.
http://www.ccsinfo.com/forum/viewtopic.php?t=21415
kevin5k



Joined: 08 Jan 2007
Posts: 41

View user's profile Send private message

PostPosted: Tue Feb 13, 2007 11:19 am     Reply with quote

Hmm...Pin_A3 is giving me some problems with my circuit and its setup is as such...

Pin_A3 = Input from Zener Diode from a Slave board. Slave board is connected to Master board (holding the PIC) using a DB9 Socket Connector. Now the thing is, if I did not connect the DB9 connector from the Master board to the Slave board, a small voltage of about 1.5V can be measured at Pin_A3 which indicates a logic 'high' to the PIC which isn't what i want.

But when the DB9 connector is connected, everything functions normally.

I did read from the Datasheet that RA0,RA3 & RA5 have some special function....Do U think it is the reason that is causing the problem?

Guys, what would U suggest?Is it software or is it just my circuit? Evil or Very Mad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 13, 2007 12:37 pm     Reply with quote

You need to give us complete details on the external circuit. Tell us the
device that the PIC is connected to, and all components (resistors,
capacitors, zeners, etc). Explain the connections verbally or perhaps
with ASCII art (be sure to preview it before posting, to make sure it
displays correctly). Give all component values (including the Zener
voltage).
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, 3, 4
Page 4 of 4

 
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