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

3 & half digit LCD segmented

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







3 & half digit LCD segmented
PostPosted: Wed Mar 02, 2005 12:27 pm     Reply with quote

Aloha !

Before i ask question regarding this type of display please take a look into the photo / link so you can see what in talking about...

http://www1.at.conrad.com/scripts/wgate/zcop_at/~flN0YXRlPTE4MzI0NDY4NzU=?~template=PCAT_AREA_S_BROWSE&glb_user_js=Y&shop=A_B2C_AT&p_init_ipc=X&~cookies=1
OR
goto www.conrad.at and enter 185671 into search / suche

Question:
I have connected this display on the static way and sofar it's working very good ( accept you must uncharge him on some way).
Im using last tree digits and now i want to learn how to control each segment and is there any library for this...

Till now i have used just multiplexed version of 4 * 7 seg. diplay so any help for this type of display would be good...

Chips im using are 16F917 or 18F452 and microchip ICD2 on PICDEM.

TaiChipY
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 02, 2005 1:50 pm     Reply with quote

You may be the only one using this chip. I suggest that you experiment.
Define the addresses of the LCD data registers with #byte statements.
Then write directly to these registers and see what happens.


Here's some sample code. This code writes 0x01 to the LCDDATA0
register. Then, each time you press the Enter key, it shifts the initial
value one bit to the left. It becomes 0x02, then 0x04, then 0x08, etc.
So only 1 bit is set in the byte, but it's a different bit each time.
Then watch the LCD and see what happens. Probably it will light up
a different segment each time you press Enter. You can write down
which segment gets lit up for each bit position in LCDDATA0. Make
a map of this. Learn by doing experiments.

Code:
#byte LCDDATA0 = 0x110
#byte LCDDATA1 = 0x111

main()
{
char i;
char value;

// Put your LCD setup code here.

value = 0x01;

for(i = 0; i < 8; i++)
    {
      printf("Value written to LCDDATA0 = %x \n\r", value);
      LCDDATA0 = value;     
      value << 1;
      getc();
    }

while(1);
}
TaiChipY
Guest







PostPosted: Thu Mar 03, 2005 4:58 am     Reply with quote

Hi PCM Programmer!

I will try your code soon as possible. Im testing the 917 but as far as i know this chip is "rather" old ... over 8 months and its often used in work with this type of display...
If you work on static way you can use 23 segments ( 23 pins on chip ) which are predefined...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 03, 2005 11:22 am     Reply with quote

I based my comment about the 16F917 on this:

On the Microchip page, they say, "Status: Future Product"
http://www.microchip.com/stellent/idcplgidcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en020202

If you click on "Buy/Sample Options" on the left side of the page,
you get this page, which says:
"Currently there are no purchasable parts provided for this device.
Please check back later!"
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1953&device=en020202

If I go to major U.S. distributors, I get these results:
http://www.digikey.com "No Stock"
http://www.future-active.com "Call for availability"
http://www.arrow.com "No Stock"

It may only be available in your location.
TaiChipY
Guest







PostPosted: Fri Mar 04, 2005 3:20 am     Reply with quote

Yes its a bit complicated to get this chip but you can send e-mail.

back to question:

In the newes PCM version there's support for 917 series. I still didn't try this newest version but, if there is support for this series is there some example how to use static display...

I have tested your code and i get some display. but messed up.
Im asking this becuse, if each segment is connected to each pin an if each single pin should light up each sigle segment then how to organize the right display...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 04, 2005 12:54 pm     Reply with quote

I don't think there are any examples for the 16F91x series.
CCS has one small example file, EX_92LCD.C, for the 16C92x series.
Look for this file in c:\Program Files\Picc\Examples

My suggestion is to look at all the Microchip appnotes for the 16C92x
series, because these chips are similar to the 16F91x. Here are
some of them:

Yet Another Clock Featuring the PIC16C924:
http://ww1.microchip.com/downloads/en/AppNotes/00649a.pdf

PicDem3 User's Guide:
http://ww1.microchip.com/downloads/en/DeviceDoc/51079a.pdf
TaiChipY



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 7:03 am     Reply with quote

I'm finally back to my display project and i want to retry your code
( the original rs232 version ).

I have add the #use rs232 part and connect the rs232 cable to my PICDEM board to test your code.
I started the hyperterminal to test the connection and serial connection was established.

Question Q.1.
Till now i have used usb cable to connect ICD with computer( with no problems). I have tryed to connect serial cable to ICD but MPLAB is not working (COM1, 19200 ). So i connected the rs232 directly to demo board ( so i can test your code ) and usb is used as connection between
ICD and computer.
How would you make rs232 test if you have this situation?

Question Q.2.
In this display type i have connected the com (together) and put them to D2 pin. Tell me, is there maybe something alse to add before i can make test / LCDDATA part, becuse i get one or sometimes two segments lighted up, without any program on the chip?
TaiChipY



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 9:22 am     Reply with quote

... one more thing. Becuse i have to use PICDEM then PIN ( for COM ) is set to pin 11(VDD).
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 9:47 am     Reply with quote

I'm glad you brought this up again because I just spotted a bug
in the code I posted. I don't have your LCD chip so I didn't test
it, and normally I test everything I post. Anyway, the changes
are shown in bold, below. It should work better now.

main()
{
char i;
char value;

// Put your LCD setup code here.
value = 0x01;

for(i = 0; i < 8; i++)
{
printf("Value written to LCDDATA0 = %x \n\r", value);
LCDDATA0 = value;
value <<= 1; // This line has been changed.
getc();
}

while(1);
}

Quote:

So i connected the rs232 directly to demo board ( so i can test
your code ) and usb is used as connection between ICD and computer.
How would you make rs232 test if you have this situation?

You should start a terminal program, such as Hyperterminal (or
maybe a better one). Then watch the output on the terminal window
and press the Enter key to step the program through the for() loop.
Also watch the LCD and study which segments to light up as you press
the Enter key.

Quote:
i get one or sometimes two segments lighted up, without any program on the chip?

This implies that the LCD data registers are not initialized to zero.
TaiChipY



Joined: 11 Mar 2005
Posts: 21

View user's profile Send private message

PostPosted: Mon Apr 04, 2005 4:43 am     Reply with quote

This are the right (tested) setting for 917 but i can get no display (using the ex_92 example.

Im not using com1,2,3 am using just com0 so i dont understand how to change the DIGIT1 part

//------------------------------
#include <16F917.h>
#fuses HS,NOWDT,PUT
#use delay(clock=8000000)

#define DIGIT1 COM1+20, COM1+18, COM2+18, COM3+20, COM2+28, COM1+28, COM2+20, COM3+18

byte const Digit_Map[10] = {0xFC,
0x60,
0xDA,
0xF2,
0x66,
0xB6,
0xBE,
0xE0,
0xFE
};

//************************************************************
#byte LCDDATA0 = 0x110
#byte LCDDATA1 = 0x111

#byte LCDCON = 0x107
#byte LCDPS = 0x108
#byte LCDSE0 = 0x11C
#byte LCDSE1 = 0x11D
#byte LCDSE2 = 0x11E

#bit BIASMD = LCDPS.6
#bit LMUX0 = LCDCON.0
#bit LMUX1 = LCDCON.1
#bit LCDEN = LCDCON.7

//************************************************************
byte lcd_pozicija;

void lcd_prikaz(char c)
{
byte segments;
if(c=='\f')
lcd_pozicija=0;
else {
if((c>='0')&&(c<='9'))
segments=Digit_Map[c-'0'];
else
segments=BLANK;
switch(lcd_pozicija)
{
case 1 : lcd_symbol(segments,DIGIT1); break;
}
}
lcd_pozicija++;
}


//************************************************************

void main()
{
long number = 0;

LCDCON = 0b00010000;
LCDPS = 0b00000100;

LCDSE0 = 0xFF; //
LCDSE1 = 0xFF; // ---
LCDSE2 = 0xFF; //
LCDEN = 1; // -- start LCD-Modul //----------------------------------------------------------------------

//setup_lcd(LCD_STATIC);

while(TRUE) {
printf(lcd_prikaz,"\%4lu",number);
if(number++==100)
number=0;
delay_ms(250);
}
}
Code:
hanh
Guest







please explain this code
PostPosted: Fri Mar 23, 2007 1:06 am     Reply with quote

Hi!

In the example file EX_92LCD.C

Code:

// Digit segments    A        B        C        D        E        F        G        DP
//                          b7       b6       b5       b4       b3       b2       b1       b0
#define DIGIT4    COM1+26, COM1+17, COM2+17, COM3+26, COM2+25, COM1+25, COM2+26, COM3+17


what does +26, +17, +25 mean?
Is it the segment??

Please explain!!!
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