write/read to floating point variable through IIC - MC9S08GB60

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

write/read to floating point variable through IIC - MC9S08GB60

1,206 Views
santhu
Contributor I
Hi,
  
   We are using MC9S08GB60 Controller.I that i'm using IIC module for communication.Our's is POWER Domain  project.In that we are using floating point variable for storing value of voltages like syst_vtg=58.90.
 
 
How can i change the data in syst_vtg of the power plant (which use the MC9S08GB60 controller ) from the remote side (which also using another MC9S08GB60 controller) through IIC. Can u suggest me how to write data to floating point variable and also how to read the data from floating point variable through IIC. And also i want to know the exact format in which HCS08 family IIC module works,because they gave IIC format like below,but they didn't mentioned the address of memory where we have to write.
 
start   slaveaddress r/w  data   stop     
 
But  in  other memory and all they clearly mentioned where to write (address register)as shown in below.
 
start   slaveaddress r/w    address register     data     stop;
 
Suggest me on this issue and attach example code if u have other than the code which is given in freescale data sheets.
 
With regards
 
Santhosh
 
 
 
Added p/n to subject.
 
 


Message Edited by NLFSJ on 2008-12-24 07:20 AM
Labels (1)
0 Kudos
1 Reply

244 Views
alexod
Contributor I
Santhosh

The following definition
start   slaveaddress r/w  data  stop    
is the format of an IIC packet.  The slave address is the address of the device you are talking to on the IIC bus.  The data address you want to write to within the target device is application specific.  In IIC memory devices the first data you send to the memory would be a seed address and command such as read or write, then the following IIC transaction would be streamed data to or from that address.

As you are controlling both ends, you will have to implement one end as the IIC slave.

You can always go to Philips or NXP for the full spec on IIC (they developed it), though the distillation in the Freescale docs should be sufficient for most of your needs.

As for sending the float serially, byte by byte, have you tried using a union of float and bytes

union txFloat{
  float32 value;
  ubyte  txBytes[4];
};

Good luck

Alex

http://en.wikipedia.org/wiki/I%C2%B2C
http://www.i2c-bus.org/

0 Kudos