Re: Ds1302
- From: "Anthony Fremont" <spam@xxxxxxxxxxxx>
- Date: Wed, 25 Jan 2006 13:03:39 GMT
<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
.
- Follow-Ups:
- Re: Ds1302
- From: nava555
- Re: Ds1302
- From: nava555
- Re: Ds1302
- References:
- Ds1302
- From: nava555
- Re: Ds1302
- From: Anthony Fremont
- Re: Ds1302
- From: nava555
- Ds1302
- Prev by Date: Re: X.10 Pro Copyright
- Next by Date: Re: Serial number rom ic, with spi or i2c interface?
- Previous by thread: Re: Ds1302
- Next by thread: Re: Ds1302
- Index(es):
Relevant Pages
|