View previous topic :: View next topic |
Author |
Message |
The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
Need simple code to test PCF8577 with LC display |
Posted: Sat Jan 21, 2006 8:53 am |
|
|
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
|
|
Posted: Thu Jan 26, 2006 4:10 pm |
|
|
Nobody can help me ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 26, 2006 4:38 pm |
|
|
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
|
|
Posted: Fri Jan 27, 2006 11:22 am |
|
|
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
|
|
Posted: Fri Jan 27, 2006 9:14 pm |
|
|
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
|
|
Posted: Sat Jan 28, 2006 5:18 am |
|
|
Thx Kenny,
now i have a start
UPDATE:
It works now
But how can i display 'COLON' between segment 2 and three? |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
|
Posted: Sun Jan 29, 2006 1:02 am |
|
|
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
|
|
Posted: Sun Jan 29, 2006 4:17 am |
|
|
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; |
|
|
|