HCS08QRUG Question about slaveAddress

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS08QRUG Question about slaveAddress

1,672 Views
UtopiaTim
Contributor III
Hi folks,
 
Starting to get up to speed on C & iic, and have been playing with the HCS08QRUG
software.
 
My test project is to talk to a 'simple' RTC from Maxim, and am modifying the routines
given to make it happen.
 
For the life of me, I cannot see where in the example code the slave's address is
declared. (or even selfAddress).  I can see how it is manipulated & then placed in
the IICD register.
 
This is probably something very basic, but if anyone has a minute, maybe they
can point me in the right direction.

Thanks!
 
Tim
Labels (1)
0 Kudos
3 Replies

529 Views
UtopiaTim
Contributor III
BTW,
 
Seems it would be a good thing for someone at Freescale to write a simple
example program that has the micro as the Master, and have it talk to a commonly
available IIC peripheral (not a memory, or other micro pretending to be an IIC part).
 
Just something simple, not with master/slave options/kitchen sink/etc ! :smileysurprised:
 
Sometimes trying to sift out all the options & ap notes is a bit tough.

Thanks,

Tim
 
 
0 Kudos

529 Views
mke_et
Contributor IV
Actually, code to talk I2C is all over the place. But from your posting, what would probably help you the most would be a sample datastream that would show how the part interacts with the master/host.

When I designed one of my devices, I has to talk to the DS1307 RTC part, and I had a choice of two Freescale parts. One didn't have I2C built in, and that was the one I was probably going to use, so I just hooked it up using the same pins just in case and wrote my code so that it manually did the I2C.

Hmm, I could post my notes as to how I got it to work, but I don't have them handy (they are commented in my source). However, I DO seem to remember that the slave address was 7 bits, not 8, and shifted 1 bit place. As a result, if you are looking at the datastream, and expect to see the address stream by, you'll miss it because of the offset.

I2C is actually pretty simple, once you get the mindset. I actually found it more complex and befuddeling to try to go back and incorporate the hardware I2C support than to just leave my routines in place.

Mike

Message Edited by mke_et on 2007-12-19 01:50 PM
0 Kudos

529 Views
bigmac
Specialist III
Hello Tim,
 
A simple way of handling an IIC slave address would be to #define a macro having the value required for the particular external device.  The macro name can then be used as a constant when sending the address byte.  An issue will be whether the value defined by the macro is already left-shifted, to allow the inclusion of the read/write bit.
 
Regards,
Mac
 
0 Kudos