Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DS12C887 interfacing with AVR micro controllerATMEGA32

Status
Not open for further replies.

chamarnadh

Member level 1
Member level 1
Joined
Nov 13, 2008
Messages
36
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
HYDERABAD,INDIA
Activity points
1,544
Hi,

Can any one help me on interfacing the DS12C887 RTC with ATMEGA32.

My problem is how we can access the DS12C887 registers with the above micro controller.DS12C887 has multiplexed Address and Data bus.

In 8051 controllers we are using with XBYTE function. But that is not working in AVR.

Any suggestions please help me, I am strucked here.

Thanks in advance
Amarnadh
 

Hello, I don't see other methods than connecting DS12C887 pins to Mega I/Os and implement the protocol in firmware.
You simply need to set pins as inputs or outputs according to the read/write cycle on the datasheet.
If you have experience with other micros I am sure you'll do it quickly with ATMega.
 

Hello, I don't see other methods than connecting DS12C887 pins to Mega I/Os and implement the protocol in firmware.
You simply need to set pins as inputs or outputs according to the read/write cycle on the datasheet.
If you have experience with other micros I am sure you'll do it quickly with ATMega.

Thank you for your reply.

I am doing like what you said. But i am unable to access the rgisters of RTC DS12C887.

I am attaching my code. Please verify and suggest the mistakes if any.

Thank you
Amarnadh
 

Attachments

  • RTC - Copy.txt
    7.8 KB · Views: 170

Two quick suggestions:

1) double-check if your RTC is set in Intel mode
2) put a delay, or at least and asm("nop") statement, between I/O change commands, like this:

AS = 0;
ASM("nop");
RD = 1;
WR = 1;
ASM("nop");
AS = 1;

I experienced similar problems connecting a DSP to an ATXMega. At the end I discovered that the I/O port is slower than the MPU, so raising and lowering the pin in sequence may SOMETIMES result in the pin not changing state. I added some _delay_us(100) and everything worked.
 
Two quick suggestions:

1) double-check if your RTC is set in Intel mode
2) put a delay, or at least and asm("nop") statement, between I/O change commands, like this:

AS = 0;
ASM("nop");
RD = 1;
WR = 1;
ASM("nop");
AS = 1;

I experienced similar problems connecting a DSP to an ATXMega. At the end I discovered that the I/O port is slower than the MPU, so raising and lowering the pin in sequence may SOMETIMES result in the pin not changing state. I added some _delay_us(100) and everything worked.

Thank you very much for your reply.

I tried with the same above after posting to u yesterday.
I found my code is working.Only RTC is the pending in my project.Yesterday we delivered the project also.
Thanks and regards
Amarnadh
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top