Цитата(Andrejka @ Jan 5 2009, 16:38)

Sample_Code_humidity_sensor_SHTxx.pdf
I have modeled the design in Proteus. Due to differences in architectures 8051 and AVR there are time restrictions in C instructions. Each assembler instruction in 8051 requires 12 clock cycles and in AVR it takes approx two cycles. So the same code will take different cycles to complete. At first time I obtained errors during measurement. When I inserted delays in code
Код
for (i=0;i<65535;i++)
{
__delay_cycles(14); //approx. 1us at 14.7456MHz quartz
if(PINB&_BV(0) == 0)
break; //wait until sensor has finished the measurement
}
in function s_measure(), I obtained all measurements are adequate.
P.S. I'm using IAR, so you have to use your delay function. If you want, I'll give you source codes for IAR that I have made to test.
Regards!
Сообщение отредактировал korobov_michael - Jan 5 2009, 20:08