CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

one wire memory loop?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Scottl



Joined: 21 Feb 2005
Posts: 25

View user's profile Send private message

one wire memory loop?
PostPosted: Thu Mar 20, 2008 9:00 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Mar 24, 2008 6:02 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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