Re: Ds1302




<nava555@xxxxxxxxx> wrote in message
news:1138132020.631059.294600@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Sir
>
> I have tried i2c betwn two Aduc's.I have just only transmitted from
> the
> master and no receive process is done.
>
> So the slave will receive the data and not transmits at all.

How do you know the slave is listening? Are you sending the proper
address?

> This is kept in interrupt polling in slave routine such as,
> when slave receives data from master the i2ci bit set in the I2CCON
> register of aduc841.(slave mode)
>
> so in the interrupt routine i have just compliment a port pin to
> indicate that the slave had receive or responded to the master's
> request.
>
> whether my procedure is correct?

I don't understand. It sounds like you have 2 microcontrollers, is that
correct? Can you post a schematic of your circuit?


> ____________________
>
> steps for slave routine
> ____________________
>
> configur aduc841in slave mode
>
> enable interrupts
>
> wait till interrupt occurs /* interrupt occurs when the master
> transmits to slave and the slave responds to it. */
>
> if (interrupt)
> {
> cpl port // to indicate the slve's response
> }
>
> is this is correct?
>
> Note:
> Master transmission is checked only in simulation.when 0x80 given in
> code the shifted data such as 0x40 occurs in the simulation. This is
> keenly explained in (Aplli. Note uc001)from analog devices.
>
> In my master routine i am sending address and data continuously.
> But there is no interrupt sense in slave. how to check this and
whether
> any changes to be done.
> Kindly help me to solve the same.
>
> reply expected eagerly

You have to send the "address" of the device you are trying to
communicate with.

Here is the PIC assembler code I use to communicate with the DS1307 RTC.

; To read the rtc, we have to set the address by pretending to do a
write. Once
; we set the address, we abort the write by doing a STOP instead of
transferring a
; byte to be written.

; Set address by starting a write procedure and then aborting it

call I2C_Start

movlw b'11010000' ; I2C /Write command to
RTC
call I2C_WriteByte
call I2C_Ack

movfw rtcregister ; Set address to slot
number
call I2C_WriteByte
call I2C_Ack


call I2C_Stop ; Abort the write after
setting address pointer

; Now read from current address

call I2C_Start

movlw b'11010001' ; I2C Read command
call I2C_WriteByte
call I2C_Ack

call I2C_ReadByte ; Read in a byte
movwf rtcvalue ; and save it

call I2C_SendNAck

call I2C_Stop ; Done



.



Relevant Pages

  • Re: Cell Documents
    ... > At a minimum a slave needs at least 1 Master triggered interrupt ... > slave to move to the next item in its work queue. ... > if a parent thread died in the master cpu or during code development ... These allow the PPE to load/read an SPU ...
    (comp.arch)
  • Aduc841 communication using i2c
    ... So the slave only receive the data and not transmits at all. ... This is kept in interrupt polling in slave routine such as, ... when slave receives data from master the i2ci bit set in the I2CCON ...
    (comp.lang.forth)
  • Synchronized SPI communication
    ... In master i continuously sends 0xff to the slave and master expects ... SPDR = cData; ... and checks if the data received is 0xff, if so then transmits buf ...
    (sci.electronics.design)
  • Synchronized SPI communication
    ... In master i continuously sends 0xff to the slave and master expects ... SPDR = cData; ... and checks if the data received is 0xff, if so then transmits buf ...
    (sci.electronics.design)
  • Synchronized SPI communication
    ... In master i continuously sends 0xff to the slave and master expects ... SPDR = cData; ... and checks if the data received is 0xff, if so then transmits buf ...
    (comp.arch.embedded)