I have problem with implementing MAX6662 chip. I have already interfaced ds1306 rtc with 3wire serial interface and it works. The problem is that the max6662 uses non usual spi interface. There are no mosi/miso pin instead of this there is one bi-directional pin DQ for data transfers. Can this chip be interfaced to this microcontroller ? How to do that (mayby use tri-state buffer's) ? For first i connected mosi and miso line from uC together and use this code:
void spi_wr(unsigned char d) { SPDR = d; while ((SPSR & 0x80) == 0) ; } unsigned char spi_rd(void) { unsigned char v; SPDR = 0xFF; while ((SPSR & 0x80) == 0) ; v = SPDR; return (v) }
... CS = 0; spi_wr(0xC1); hi = spi_rd(); lo = spi_rd(); CS = 1; ...
Ive spend lots of time for searching the net about this topic and i found only one thing: dallas an about interfacing ds1620 http://www.maxim-ic.com/appnotes.cfm/appnote_number/427 mayby this is a work around - use tri-state buffers. Lucas Bajger