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

Need simple code to test PCF8577 with LC display

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



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

Need simple code to test PCF8577 with LC display
PostPosted: Sat Jan 21, 2006 8:53 am     Reply with quote

I need simple test source code how i can drive a LC display with a PCF8577 I2C IC

Please can someone help me?

Thx
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Jan 26, 2006 4:10 pm     Reply with quote

Nobody can help me ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 26, 2006 4:38 pm     Reply with quote

You're asking us to write a driver for you. Ideally, you would at least
attempt to write one yourself and then if it fails, ask for help.
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jan 27, 2006 11:22 am     Reply with quote

PCM programmer wrote:
You're asking us to write a driver for you. Ideally, you would at least
attempt to write one yourself and then if it fails, ask for help.

No, i would have a begin,
then can i go furher which that sample code and experiment
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

PostPosted: Fri Jan 27, 2006 9:14 pm     Reply with quote

Yes, I thought that you would have realised that the code I posted for the SAA1064 was similar to
that needed for the PCF8577, and would have been able to adapt it.
I have used it before many times in battery-powered equipment.

To get you started, here's some definitions. See data sheet.

#define PCF8577_WRITE_ADDRESS 0x74 // Same for all PCF8577 devices on bus

// Control reg. bits:
// Bit7 0/1 Display has Direct drive/Duplex drive
// Bit6 0/1 Select BankA/BankB
// Bit5 Subaddress bit A2
// Bit4 Subaddress bit A1
// Bit3 Subaddress bit A0
// Bit2 Segment byte address reg. msb
// Bit1 Segment byte address reg.
// Bit0 Segment byte address reg. lsb

// Modes. Includes i2c subaddresses.
// Subaddress bit A0 not available because the pin is used for the external
// resistor (10k to com) and capacitor (0.1uf to Vcc) connection to the internal
// backplane oscillator. In this case A0 is defined as 0.
// In Direct Drive, BP2 not used, so A2 available for subaddress.
#define MODE0 0x00 // Direct drive, using Bank A, subaddr.(A2=0,A1=0,A0=0)
#define MODE1 0x10 // Direct drive, using Bank A, subaddr.(A2=0,A1=1,A0=0)
#define MODE2 0x20 // Direct drive, using Bank A, subaddr.(A2=1,A1=0,A0=0)
#define MODE3 0x30 // Direct drive, using Bank A, subaddr.(A2=1,A1=1,A0=0)

Since all PCF8577 chips on the same bus have the same address there is no need to pass the address,
only need to send the mode.
eg.
send_pcf8577_num(MODE1,count);

and in the driver
i2c_start();
i2c_write(PCF8577_WRITE_ADDRESS);
i2c_write(mode); //Send mode byte
then the digits.
Segment handling is the same as for the SAA1064, although you may need to send the digits in a different order depending on how the lcd is wired.
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat Jan 28, 2006 5:18 am     Reply with quote

Thx Kenny,

now i have a start Smile

UPDATE:

It works now

But how can i display 'COLON' between segment 2 and three?
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

PostPosted: Sun Jan 29, 2006 1:02 am     Reply with quote

If you want the colon on permanently, connect the relevant pin on the lcd to Vcc. If you want to turn it on and off in software connect the pin on the lcd to a pin on the PCF8577 that would otherwise be used for turning a decimal point on and off.
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Jan 29, 2006 4:17 am     Reply with quote

Kenny wrote:
If you want the colon on permanently, connect the relevant pin on the lcd to Vcc. If you want to turn it on and off in software connect the pin on the lcd to a pin on the PCF8577 that would otherwise be used for turning a decimal point on and off.


This command switch the dec. point on
// Add decimal point if required
led_data[2] |= 0x80;

led_data[2] |= 0xFF;
switch dec. point and colon on

But what swith command switch only the colon on

Colon is conected to S8 pin of the PCF8577

Problem solved
I have found it already
led_data[0] |= 0x80;
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