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

About LCD control

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jaethelegend
Guest







About LCD control
PostPosted: Sat Jun 06, 2009 7:01 am     Reply with quote

Hi, I was originally using a full PORT with all 8 ports available to control a LCD display, connecting RA0~2 to RS,RW,EN and RA4~7 to D04~7.
It worked fine.

Now, i tried to practice different ways of doing it for later use by
connecting RA0~3 to D4~7 and RS to D5, RW to D6, R7 to EN.

I guess the biggest difference between first coding scheme and the second coding scheme is that in first coding scheme, i controlled(outputted) the entire 7 required bits to the LCD at a time. In second time, I played with the output ports before i pulsed enable signal.
below is quick code example
First Scheme which worked fine.
Code:
void Busy_Check(){
   int8 high_nibble, low_nibble;
   do{
      LCD_TRIS = 0b10000000;
      LCD_PORT = 0b00000110; // RS=0, RW=1 EN=1
     
      delay_us(14);
      high_nibble=LCD_PORT;
      delay_us(14);
     
      LCD_PORT = 0b00000010;       //RS = 0, RW = 1, EN = 0
      LCD_PORT = 0b00000110;       //RS = 0, RW = 1, EN = 1
     
      delay_us(14);
      low_nibble = LCD_PORT;
      delay_us(14);
     
      LCD_PORT = 0b00000010;          // RS = 0, RW = 1, EN = 0
      }while(high_nibble&0x80);     
     
      LCD_TRIS = 0x00;
      LCD_PORT = 0x00;
   }



Second scheme which didn't work


Code:

void busy_check(void){
   int8 high_nibble, low_nibble;
   do{
      LCD_TRIS = 0b10000000;
      LCD_PORT = 0b00000000; // RS=0, RW=1 EN=1
      R_W = 1;
     E_N = 1;
     
      delay_us(14);
      high_nibble=LCD_PORT; //LCD로 부터 나오는 상위 니블 리드.
      delay_us(14);
      E_N = 0;
      E_N = 1;
      delay_us(14);
      low_nibble = LCD_PORT;
      delay_us(14);
     
      E_N = 0;       // RS = 0, RW = 1, EN = 0
      }while(high_nibble&0x80);     //D7 이 1이면 받을 준비가 안됨.
     
      LCD_TRIS = 0x00;
      LCD_PORT = 0x00;
   }



Thank you, I appreciate your help
Steve H
Guest







PostPosted: Sat Jun 06, 2009 9:44 am     Reply with quote

You realize that in the 4 bit nibble mode - you have to go through a special initialize sequence for the LCD? You can find this in a bunch of places (try the CCS examples, Google or the LCD data sheet) or look at some of my code here,

http://geocities.com/hagtronics/wwvb.c

HTH - Steve H.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jun 06, 2009 11:58 am     Reply with quote

See the Flex driver here:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661

Also, the CCS LCD.c driver has flex capability starting with vs. 4.085.
jaethelegend
Guest







PostPosted: Sun Jun 07, 2009 9:46 pm     Reply with quote

Thanks guys!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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