|
|
View previous topic :: View next topic |
Author |
Message |
Scottl
Joined: 21 Feb 2005 Posts: 25
|
one wire memory loop? |
Posted: Thu Mar 20, 2008 9:00 pm |
|
|
I have a DS1921G IButton kicking my A**! I have everything working fine but I cannot find a good method for retreiving all the logs.
The logs start at 1000h! I read the mission samples counter which is 24bits unsigned integer and I only read 16bits and then clear the IButton for the next mission.
I am using some code from the forum and I do not remember who posted it but thanks! See sample below:
Code: |
unsigned int16 ds1921G_samples()
{
int8 lsb, msb, csb; // csb not needed for 16 bits
unsigned int16 samples;
float temp_log;
onewire_reset();
onewire_write(0xCC);
onewire_write(0xF0);
onewire_write(0x1B);
onewire_write(0x02);
lsb = onewire_read();
onewire_reset();
onewire_write(0xCC);
onewire_write(0xF0);
onewire_write(0x1A);
onewire_write(0x02);
msb = onewire_read();
samples= make16(lsb, msb); // 16 bits
// Here I want to loop through the memory and get the data and send it to a pc.
for (i=0;i<=samples;++i)
{
onewire_reset();
onewire_write(0xCC);
onewire_write(0xF0);
onewire_write(?????????); // Need to loop memory start to end LSB first 1000h
onewire_write(?????????); // MSB last starting at 1000h
temp_log = onewire_read(); // byte
temp_log = (float) temp_log / 2 - 40; // Maxim Conversion for DS1921G
fprintf(COM_A, "I%3.1f\r", temp_log);
}
|
Does anyone have a good method on how I can loop through the LSB and MSB values to command the IButton for the data?
Thanks in advance,
Greg |
|
|
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Mon Mar 24, 2008 6:02 pm |
|
|
Howdy,
I only briefly looked at the data sheet from Maxim. I think you can select the starting address for reading from memory. The flow chart on page 20 looks promising.
Mast Tx -> TA1(T7:T0), TA2 (T15:T8). Target address register indicate memory address to read.
Again, I only quickly scanned the datasheet and probably missed something crucial, but this looks a good path.
Cheers,
JMA |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|