Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Humidity error

Status
Not open for further replies.

nomnom

New Member
Hi , it seem my code suceeded build but LCD did not display anything need help... :D
 

Attachments

  • humidity.txt
    11.5 KB · Views: 178
  • Sht11.inc.txt
    16.7 KB · Views: 235
But whole code i copy from the X-robotic webside is there still wrong for this code... ?

hi,
The code works OK in the Oshonsoft simulator, is your project wiring correct.?
 

Attachments

  • AAesp01.gif
    AAesp01.gif
    8.7 KB · Views: 190

Many thanks, will look thru the d/s, get back to you.

From the program, it looks as though the project shares the PORTB with the LCD and humidity sensor, so that where the problem could be when using a different sensor.

EDIT:
A quick look at the d/s, shows that the SHT is I2C connection and the HND is analog they are not compatible.
 

Attachments

  • AAesp03.gif
    AAesp03.gif
    29.1 KB · Views: 197
  • AAesp04.gif
    AAesp04.gif
    23.1 KB · Views: 201
Last edited:
DELAY_5MS movlw .6 ;
movwf PDel0 ;
PLoop1 movlw .207 ;
movwf PDel1 ;
PLoop2 nop
decfsz PDel1, 1 ;
goto PLoop2 ;
decfsz PDel0, 1 ;
goto PLoop1 ;
PDelL1 goto PDelL2 ;
PDelL2 nop ;
return ;

I don't understand this delay can ... wht it mean
 
Code:
;-------------------------------------------------------------
; Description: Waits 2000000 cycles     2 segundos
;-------------------------------------------------------------
PDelay      movlw   .167      ; 1 set number of repetitions (C)
            movwf   PDel0     ; 1 |
PLoop0s      movlw   .41       ; 1 set number of repetitions (B)
            movwf   PDel1     ; 1 |
PLoop1s      movlw   .72       ; 1 set number of repetitions (A)
            movwf   PDel2     ; 1 |
PLoop2s      nop              ; 1 clear watchdog
            decfsz  PDel2, 1  ; 1 + (1) is the time over? (A)
            goto    PLoop2s    ; 2 no, loop
            decfsz  PDel1,  1 ; 1 + (1) is the time over? (B)
            goto    PLoop1s    ; 2 no, loop
            decfsz  PDel0,  1 ; 1 + (1) is the time over? (C)
            goto    PLoop0s    ; 2 no, loop
PDelL1s      goto     PDelL2s         ; 2 cycles delay
PDelL2s      nop              ; 1 cycle delay
            return              ; 2+2 Done
;-------------------------------------------------------------
Its a 2 second delay loop before reading the sensor.

I did explain earlier that the program will not work with your Analog sensor...:)

LOOK at post #9
 
Last edited:
DELAY_5MS movlw .6
movwf PDel0
PLoop1 movlw .207
movwf PDel1
PLoop2 nop
decfsz PDel1, 1 ; 1 + (1) is the time over? (A)
goto PLoop2
decfsz PDel0, 1
goto PLoop1
PDelL1 goto PDelL2
PDelL2 nop
return

Guy how to explain this type of delay ... i not pretty understand... ?:D
 
hi,
My post #12, has comments from the original author.

Its just a series of 3 delay loops, being called in sequence and repeated, until all the loop counters are zero.

Standard loop delay subroutine.
 
Yes i do understand my analog sensor wont work but im don't understand for the delay calculation .
How do calculate and loop for 2 sec be4 read sensor :D
 
Yes i do understand my analog sensor wont work but im don't understand for the delay calculation .
How do calculate and loop for 2 sec be4 read sensor :D

Use the subroutine in my post, the author claims its a 2 second delay.:D

Look at this link, its a free loop calculator program.
http://www.biltronix.com/picloops.html
 
Last edited:
Guys , im not sure about the SN-HMD humidity sensor and 16f877A
It seem already have temperature and humid together ,
So if i apply this calculation izit will be similar
Vref+ = 5V (apply with RA3 =vref+ ,it will always in + value and won't become -value)
Vref- = GND(0V)
minimum output of LM35 = 10mv at 1 Celsius (= 0.01 v)
if the ADC works in 10bit the result will be like this:
5V ------------> 1024
0.01V --------> X
X = 2.048 ( 2 in hex appro)
So each change in temperature will give 2 in the (ADRESL-ADRESH) registers.?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top