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-problem occur with 3.205

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







Lcd-problem occur with 3.205
PostPosted: Wed Jul 14, 2004 2:44 am     Reply with quote

this driver works fine with 3.190, but it dont work it all with 3.205
i need help!
/thanks
Code:
#bit      LcdEnable      =   PORTB.0
#bit      LcdRS         =   PORTB.1
#bit      LcdRW         =   PORTB.2
#bit      LcdD4         =   PORTC.0
#bit      LcdD5         =   PORTC.1
#bit      LcdD6         =   PORTC.2
#bit      LcdD7         =   PORTC.3
#define lcd_type      2         // 0=5x7, 1=5x10, 2=2 lines
#define lcd_line_two   64         // LCD RAM address for the second line
#define lcd_line_three   16         // LCD RAM address for the third line
#define lcd_line_four   80         // LCD RAM address for the fourth line

byte CONST LCD_INIT_STRING[4] = {(0x20 | (lcd_type << 2)), 0xc, 1, 6};
         // Special characters �/�/�/�/g/down-arrow/up-arrow/bargraph test
byte CONST FONT[64]={4,0,14,1,15,17,15,0,  4,4,10,17,31,17,17,0,  10,4,10,17,31,17,17,0,  10,14,17,17,17,17,14,0,
               0,0,15,17,17,15,1,14,  0,14,14,14,31,14,4,0,  0,4,14,31,14,14,14,0,  21,21,21,21,21,21,21,0};

//********************************************************
// LCD Send nibble
//********************************************************

void lcd_send_nibble( int8 n )
   {
   LcdD4 = n & 1;
   LcdD5 = n & 2;
   LcdD6 = n & 4;
   LcdD7 = n & 8;
   delay_cycles(1);
   LcdEnable = 1;
   delay_us(2);
   LcdEnable = 0;
   }

//********************************************************
// LCD Send byte
//********************************************************

void lcd_send_byte( int8 address, int8 n )
   {
   delay_ms(2);
   LcdRS = address;
   delay_cycles(1);
   LcdRW = 0;
   delay_cycles(1);
   LcdEnable = 0;
   lcd_send_nibble(n >> 4);
   lcd_send_nibble(n & 0xf);
   }

//********************************************************
// LCD Init
//********************************************************

void lcd_init()
   {
   int8 i;
   LcdRS = 0;
   LcdRW = 0;
   LcdEnable = 0;
   delay_ms(15);
   for(i=1;i<=3;++i)
      {
      lcd_send_nibble(3);
      delay_ms(5);
      }
   lcd_send_nibble(2);
   for(i=0;i<=3;++i)
      lcd_send_byte(0,LCD_INIT_STRING[i]);
   for(i=0;i<64;i++)
      {
      lcd_send_byte(0,0x40+i);
      lcd_send_byte(1,FONT[i]);
      }
   }

//********************************************************
// LCD Goto XY
//********************************************************

void lcd_gotoxy( int8 x, int8 y)
   {
   int8 address;
   switch (y)
      {
      case 2:
         address=lcd_line_two;
         break;
      case 3:
         address=lcd_line_three;
         break;
      case 4:
         address=lcd_line_four;
         break;
      default:
         address=0;
         break;
      }
   address+=x-1;
   lcd_send_byte(0,0x80|address);
   }

//********************************************************
// LCD Putc
//********************************************************

void lcd_putc( char c)
   {
   switch (c)
      {
      case '�':
         lcd_send_byte(1,0);
         break;
      case '�':
         lcd_send_byte(1,225);
         break;
      case '�':
         lcd_send_byte(1,239);
         break;
      case '�':
         lcd_send_byte(1,1);
         break;
      case '�':
         lcd_send_byte(1,2);
         break;
      case '�':
         lcd_send_byte(1,3);
         break;
      case 'g':
         lcd_send_byte(1,4);
         break;
      case '\f':
         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;
      }
   }
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Wed Jul 14, 2004 5:02 am     Reply with quote

If it is working fine with 3.190 but not working under 3.205, it means your code is fine and you are experiencing a compiler bug.
Try to pinpoint the exact location of the problem, and then send it to the CCS tech support so they can fix the bug. In the meantime you can go back to using version 3.190 as it compiles your code fine.
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