free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems
I BOUGHT HH10D sensor from here : http://www.sunrom.com/index.php?main_page=product_info&products_id=758
It cost me Rs.650 INR. I googled for HIH-4000-001 and the price was Rs.2000 INR so opted for HH10D.
As for the CODE, YES i managed to get it to work. But its not the RIGHT way of using the sensor. The RIGHT way is to use the I2C Bus and read the values from EEPROM on the sensor.
But i never succeeded in the MENTIONED formula usage.
So i finally managed in getting the OUTPUT by i technique.
This is my code, written in C :
CODE:
#include<reg51.h> sbit freqOut = P2^1; sfr ldata=0x90; bit timeout; unsignedint timeCount; void lcdcmd(unsignedchar value); void msdelay(unsignedint value); void lcddata(unsignedchar value1); sbit rs=P3^0; sbit rw=P3^1; sbit en=P3^2; void timer0_isr(void)interrupt3 {
timeCount= timeCount+1; if(timeCount==10000)// 0.1m*10000=1sec {
timeCount=0;// Reset the TimeCount after every 1 Second
timeout=1;// Set the timeout=1 ( variable to start the Pulse count in the While loop)
ET1 =0; } }
//Checking the Humidity Limits: //LOGIC: //RH% ranges from 0 to 100 through 5k to 10k freq.. So change in freq = 5K. //5K/100 = 50. So for every increment of freq count by 50, there is one increment in RH value in %
if(count>4999&& count<10001)// Limiting the calculations to the desired limits of 5k to 10k) {
d=count-5000;// Obtaining the Difference in the Freq.
d=d/50;// Divide with 50 to get the RH value
y=d/10;// obtaining the tens position integer and assigning to variable y
z=d%10;// Modulo Division to obtain the Remainder value (the ONEs place) and Assigning the value to variable z
y=y+48;// converting the integer to its equivalent ASCII code
z=z+48;// converting the integer to its equivalent ASCII code
for(i=0;DTa[i]!='@';i++) {
lcddata(DTa[i]);// passing the data "RH% =" to the LCD }
lcddata(y);// passing the value of y to the LCD
lcddata(z);// passing the value of z to the LCD
lcddata(37);// passing the symbol "%" using its ASCII code (37) to the LCD }
if(count<5000|| count>10000)// If the Freq. is below 5k or greater than 10k ERROR message is displayed { for(i=0;DTa[i]!='@';i++) {
lcddata(DTa[i]);// passing the data "RH% =" to the LCD }
for(i=0;DTb[i]!='@'; i++) {
lcddata(DTb[i]);// passing the data "Err" to the LCD } }
As for the CODE, YES i managed to get it to work. But its not the RIGHT way of using the sensor. The RIGHT way is to use the I2C Bus and read the values from EEPROM on the sensor.
Measuring the frequency is the right way to use this sensor. The EEPROM only contains calibration data and is only for that one device. They could, perhaps should, have written it on a lable.
firoz3321 wrote ...
// code to count number of pulses at port p1.1 when input p1.2 is enabled
Measuring the frequency is the right way to use this sensor. The EEPROM only contains calibration data and is only for that one device. They could, perhaps should, have written it on a lable.
Well there is a HUGE formula. And i suppose its the proper way of getting it done.
ExperimenterUK wrote ...
Why does pin p1.2 have to be enabled ?.
Well i removed the comment now
Actually i was using that pin for a toggle switch so that i can start the count. Now i removed it ( Later realised there was no use of it ). Regards, Feroze
is there any easy way of converting the C code to ASM ?
I doubt it, but this code is not complicated so someone used to ASM could do it quite quickly. You can simplify it by counting for 20 milliseconds rather than 1000 milliseconds. This will save dividing by 50 later.
firoz3321 wrote ...
I'm not able to make it done. How to count 10000 ? it doesn't take it
Does it work at 9000,9999... ? where does it go wrong ?
Can you attach a copy of the full Greenbee program you are trying to patch into.
8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems