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

LCDDATA0 LCDDATA1

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



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

LCDDATA0 LCDDATA1
PostPosted: Wed Apr 20, 2005 10:42 am     Reply with quote

How to control the LCD segments, wenn those segments are in different LCDDATA registers (chip is from the 16F91X serie ) ?

Eg.
LCDDATA0 --- segment A1,B1,C1,D1 --> E1,F1,G1 should be in the LCDDATA0 but there are in the LCDDATA1 and in LCDDATA2 ( hardware connected ).

So wenn i call function to display num. 8 from the LCDDATA0 register i get displayed just the first four segments. OK i know i have to join other
registers to get correctly displayed one number...

It seens easy but im using 23 segments and most of the segment are in "wrong" LCDDATA register...

This are the orginal functions that i use ( if the LCD would be connected right ) to display numbers.


Code:

byte const num[10]  ={   0b11001111, // 0
      0b00000011, // 1
      0b10101101, // 2
      0b10100111, // 3
      0b00101001, // 4
      0b11100110, // 5
      0b11101110, // 6
      0b11000011, // 7
      0b11101111, // 8
      0b11100111  // 9   
      };

void lcd_symbol(byte segments, byte pos)
{
    switch (pos)
  {
   case 1:
      LCDDATA0 = segments;
      break;
   case 2:
      LCDDATA1 = segments;
      break;
   case 3:
      LCDDATA2 = segments;
      break;
  }
 
}

byte lcd_pos;
void lcd_display(char c)
{
   byte segments;

   if(c=='\f')
     lcd_pos=0;
   else
   {
     if((c>='0')&&(c<='9'))
     segments = num[c-'0'];
   }
   lcd_pos++;
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 20, 2005 2:07 pm     Reply with quote

On the CCS versions page, they say this:
Quote:
3.223 LCD support for the newest parts with direct LCD drive has been added.

I took their EX_92LCD.C file, and changed the #include statement to
use the 16F917. While doing this, I noticed that the 16F917.H file
is missing some of the #define statements for SEG0_4, SEG5_8, etc.,
that appear in the 16C924.H file. So I copied those #defines into
16F917.H. Then I was able to compile EX_92LCD.C without errors.

EX_92LCD.C has a set of #define statements which define the
location of the segments within the LCD data registers.

Then it calls the lcd_symbol() function which then sets individual
bits within the LCDDATA registers, in order to display the proper symbol.

I looked briefly at the .LST file, and it appears to be writing to LCDDATA
registers at the proper addresses for the 16F917 chip.

So I suggest that you upgrade to PCM vs. 3.223 and try this.

I don't guarantee that CCS has implemented their LCD functions
correctly for the 16F917, because I didn't review the .LST file in detail.
I also don't want to do so. I just want to let you know of one possible
way to solve your problem.
TaiChipY



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

PostPosted: Thu Apr 21, 2005 2:42 am     Reply with quote

So I suggest that you upgrade to PCM vs. 3.223 and try this.
***

I hope im dreaming :--) !. I can't make update becuse the monthly update rights are over (before week or two ) and this is the only thing that i need ( i have not much time left for ending the project )...

Is there a way to talk to guys at ccs, so i can get the newest header file for this device??


Anyway, thank you for your replay and time taken to look into code.
TaiChipY



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

PostPosted: Thu Apr 28, 2005 9:50 am     Reply with quote

hmmm.. if we skip my last unnecessary question, then this one looks a bit like, new approach :--))

After sucessfull testing and controling the LCD output (direct access!) i want to test this function but i get weird situation....

When i run lcd_display function without switch case, function is working correctly but when i hit the switch case part i get compiler error: Line 79(38,46): Expect comma

So i write new function called lcd_segments. This function is holding just the switch case part, but the error is the same.

All LCD registres are setup correctly and if you run test on this way:
LCDDATA0 = number[8];
you will get correct output.


Code:
 
//----------------------------
#byte LCDDATA0 = 0x110
#byte LCDDATA1 = 0x111
#byte LCDDATA2 = 0x112

byte const number[10] ={0b11001111, // 0
      0b00000011, // 1
      0b10101101, // 2
      0b10100111, // 3
      0b00101001, // 4
      0b11100110, // 5
      0b11101110, // 6
      0b11000011, // 7
      0b11101111, // 8
      0b11100111  // 9   
                 };

 
byte lcd_pos;
void lcd_display(char c)
{
   byte segments;

   if(c=='\f')
     lcd_pos=0;
   else
   {
     if((c>='0')&&(c<='9'))
     segments = number[c-'0'];
   }
   lcd_pos++;
}


void lcd_segments(byte segments,byte pos)
{
  switch (pos)
  {
   case 1:
      LCDDATA0 = segments;
      break;
   case 2:
      LCDDATA1 = segments;
      break;
   case 3:
      LCDDATA2 = segments;
      break;
  }         
   
}


TaiChipY
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 28, 2005 11:59 am     Reply with quote

I'm not quite sure what your problem is.

1. Do you get a compiler error ?

or,

2. Does the program compile OK, but not run properly ?
TaiChipy_not_logged_in
Guest







PostPosted: Fri Apr 29, 2005 1:35 am     Reply with quote

the switch case part i get compiler error: Line 79(38,46): Expect comma

The program stops on compile.
This happens just wenn i add switch case in the function ( on the way i have described before ).

I tested for missing commas (other missing stuff ) but like i write , everything is working until this switch case part...


TaiChipY
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 29, 2005 4:24 pm     Reply with quote

I made a test program and compiled your code with PCM vs. 3223
and there were no errors. You didn't give your version and all
versions are different. I probably have at least 160 versions
of PCM on my PC, so it's a bit difficult to give you accurate help
on a compiler error without knowing your version. By now,
you should know to give it on a question like this. Mr. Green
TaiChipY



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

PostPosted: Wed May 04, 2005 8:24 am     Reply with quote

With 3.223 is working ok but when i call

Code:
byte lcd_pos;
void lcd_display(char c)
{
   byte segments;

   if(c=='\f')
     lcd_pos=0;
   else
   {
     if((c>='0')&&(c<='9'))
      segments = number[c-'0'];
      else
      segments=BLANK;
      switch (lcd_pos)
      {
       case 1:
      LCDDATA0 = segments;
      break;
      case 2:
      LCDDATA1 = segments;
      break;
      case 3:
      LCDDATA2 = segments;
      break;
  }
  }
   lcd_pos++;
}
main(){
char i=0;
printf(lcd_display,"\f %x",i);
}


i get no display on LCD. I have tested with different formating, different
types and so on...
Direct access thru LCDDATA ( bescribed before ) is workung very good.

I know that this is not the solution but if can start this function should i switch to some new function with predefined LCDDATA numbers ?
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