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

16F876 & SHT71

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



Joined: 18 Aug 2005
Posts: 3
Location: Paris

View user's profile Send private message

16F876 & SHT71
PostPosted: Thu Aug 18, 2005 4:15 pm     Reply with quote

Hello

I has fought for 2 days to make the calculation of the CRC between a SHT71 and a PIC16F876.
Even with the scope note from sensirion I do not arrive there Crying or Very sad

http://www.sensirion.com/images/getFile?id=80

The calculation of the CRC at sensirion is not standard. I found at DALLAS a scope note (27) which uses the same principle but within sight of the table of CRC from Dallas the result is different.

My crontrainte is not to be able to use a table of CRC (no more place available)

If you have ideas or solutions I am taking
@+

Michel
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

View user's profile Send private message Send e-mail Yahoo Messenger

Re: 16F876 & SHT71
PostPosted: Thu Aug 18, 2005 4:20 pm     Reply with quote

mce91 wrote:

My crontrainte is not to be able to use a table of CRC (no more place available)
Michel


If that is your only problem, then go upgrade your PIC16F876 to a PIC18F252. You'll now have double the space.
mce91



Joined: 18 Aug 2005
Posts: 3
Location: Paris

View user's profile Send private message

Re: 16F876 & SHT71
PostPosted: Thu Aug 18, 2005 4:33 pm     Reply with quote

MikeValencia wrote:
mce91 wrote:

My crontrainte is not to be able to use a table of CRC (no more place available)
Michel


If that is your only problem, then go upgrade your PIC16F876 to a PIC18F252. You'll now have double the space.


using another PIC is not the solution ...
mce91



Joined: 18 Aug 2005
Posts: 3
Location: Paris

View user's profile Send private message

16F876 & SHT71
PostPosted: Fri Aug 19, 2005 5:21 pm     Reply with quote

After lot of hours ... the solution by my self !!! Very Happy

unsigned int8 crc_sht (char *data,unsigned char oldcrc, unsigned int8 length)
{
unsigned int8 i=0, ibit=0, c=0, crc;


#bit crc4 = crc.4
#bit crc5 = crc.5
#bit crc7 = crc.7
#bit c7 = c.7

crc=oldcrc;
data++;

for (i = 0; i < length; i++, data--)

{
c = *data;
for (ibit = 0; ibit < 8; ibit++)
{
if (c7 == crc7)
{
crc = crc << 1;
crc = crc & 0xFE;
}
else
{
crc = crc << 1;
crc4 = ~(crc4) ;
crc5 = ~(crc5) ;
crc = crc | 0x01;
}
c = c << 1;
}
}
return crc;
}
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