Controlling PCF8583 clock chip with a PIC

I have a board set up with a PIC16F877 microcontroller and on the I2C bus I have a Phillips PCF8583 clock/alarm chip.

I am attempting to use the alarm function of this chip and thus far am having almost no luck getting it to work. I know the I2C bus is good because I have several other devices on it plus the clock function of this chip is working fine.

Specifically, no matter what type of alarm I instruct the chip to enable (i.e. daily, weekly, etc.) none of them seem to function. I can test this by checking the interrupt output pin of the chip with a scope. The interrupt generation is enabled, but nothing shows on the pin.

I realize this is rather general. My hope is that somebody else has used this chip and may be able to help me with my problem. If, by any remote chance, you have, please contact me or post a followup.

--
--John Gruenenfelder    Research Assistant, Steward Observatory, U of Arizona
                        johng@as.arizona.edu
Try Weasel Reader for PalmOS  --  http://gutenpalm.sf.net
"This is the most fun I've had without being drenched in the blood
of my enemies!"
        --Sam of Sam & Max
Reply to
John Gruenenfelder
Loading thread data ...

The interrupt output seems to be a open drain output... So it will only supply a path to ground when an interrupt is active, or high impedance when not; in other words, you will see nothing on your scope... Add a pull up resistor to VCC.

Hope this helps, Jeroen

Reply to
Jeroen

Jeroen schrieb:

Besides, if you don't really need the RAM consider the PCF 8563. It's a more modern chip, which much less supply current and faster I2C interface. Cheaper, too. Philips has an application note about the various RTC chips that contains a comparison between them.

--
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
http://www.autometer.de
Reply to
Tilmann Reh

Our board is set up correctly in this respect. The pull up resistor is there, and we have tested the power-on 50% duty cycle interrupt generated by the 8583 which does work. It's just the interrupt that is to be triggered by the alarm function which never occurs.

For a little more information, here is how I am setting the alarm:

write_clk(CLOCK_CONTROL, 0x04); // stop 1Hz reset, enable alarm write_clk(ALARM_WEEKDAY, 0x40); // weekly alarm on weekday 6 write_clk(ALARM_CONTROL, 0xA0); // enable weekly alarm and interrupt

The first argument is the address to write to. The ones used above are defined as:

#define CLOCK_CONTROL 0x00 #define ALARM_CONTROL 0x08 #define ALARM_WEEKDAY 0x0E

And the function to set the alarm values is:

#define CLK_WRITE 0xA0 void write_clk(byte address, byte data) { i2c_start(); i2c_write(CLK_WRITE); i2c_write(address); i2c_write(data); i2c_stop(); }

That's about it. It's really simple, but it just doesn't seem to work. The I2C functions are verified as there are used extensively elsewhere. The values are set properly in the clock/alarm. They can be read back and verified.

--
--John Gruenenfelder    Research Assistant, Steward Observatory, U of Arizona
                        johng@as.arizona.edu
Try Weasel Reader for PalmOS  --  http://gutenpalm.sf.net
"This is the most fun I've had without being drenched in the blood
of my enemies!"
        --Sam of Sam & Max
Reply to
John Gruenenfelder

To be honest, we aren't using any of the RAM on the chip. This board (for a Cubesat) was designed a couple of years ago. I'm not sure who made the choice of clock chip or why, but that's what is there now. In hindsight, though, you're quite right that the 8563 would have been a much better choice.

--
--John Gruenenfelder    Research Assistant, Steward Observatory, U of Arizona
                        johng@as.arizona.edu
Try Weasel Reader for PalmOS  --  http://gutenpalm.sf.net
"This is the most fun I've had without being drenched in the blood
of my enemies!"
        --Sam of Sam & Max
Reply to
John Gruenenfelder

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.