Elektroda.pl
Elektroda.pl
X
Proszę, dodaj wyjątek www.elektroda.pl do Adblock.
Dzięki temu, że oglądasz reklamy, wspierasz portal i użytkowników.

[AVR][Bascom]barometr with hp02s

mahin2010 26 Maj 2013 08:39 3609 18
  • #1 26 Maj 2013 08:39
    mahin2010
    Poziom 6  

    hello
    i am using the hp02s sensor in a circuit for barometr.i have read of the calibration
    value d0=46170,t0=35393,p0=10127,s=340,c=298 .my value for t1 and d1 61423 61423.please help me.they are t1=d1?vcc=5v and i make with timer0 a frequency for mclk.and my frequency atmega 32 is 1MHz
    i am using lcd for display. i think my freaquency mclk is mistek.am i corect?

    https://obrazki.elektroda.pl/index.php :cry:
    ============================

    Kod: basic4gl
    Zaloguj się, aby zobaczyć kod
    Added syntax tags for easier reading.
    LordBlick.

    0 18
  • #2 26 Maj 2013 09:11
    atom1477
    Poziom 43  

    The Timer_isr function takes too much time.
    Much more than 12 cycles as you want to perform.
    Therefore, MCLK is much slower than the required 32 kHz.
    You should toggle PortB.5 (MCLK) hardwarly, not softwarly.
    Hapilly PortB.5 is OC1A output od Timer1.
    Or, you may try to run Atmega on highest frequency. For example 8MHz.
    Then Timer_isr maybe will be take place (then they will have 125 cycles).

    0
  • #3 26 Maj 2013 09:35
    mahin2010
    Poziom 6  

    hello and very tanks for your replay. if i change my frequncy to 8000000 how i change my fusebit?i dont know it?

    0
  • #5 26 Maj 2013 12:21
    mahin2010
    Poziom 6  

    do you like there? https://obrazki.elektroda.pl/4379179000_1369555342.jpg
    but there are 2 case.
    010100 int rc osc.8Mhz
    100100 int rc osc.8Hhz
    which case i shoud select?

    Dodano po 2 [godziny] 18 [minuty]:

    excuseme i have another question? i want use this barometr for sens pressur then high for 200 cm do it able? please replay to me? i am very sad. thank you very much. for replay 2 my question

    0
  • #6 26 Maj 2013 14:08
    atom1477
    Poziom 43  

    I think both ale correct.
    But choose the first one.

    Resolution probably will detect changing height on 200cm, but the accuracy not (it will float more than 200cm so device must be calibrated before each measurement).

    0
  • #7 26 Maj 2013 14:09
    LordBlick
    VIP Zasłużony dla elektroda

    It does not matter whether you are sad or cheerful. Always look on bright side of datasheet ;)

    0
  • #8 26 Maj 2013 15:58
    mahin2010
    Poziom 6  

    very thanks. it is true. The sensitivity of the sensor is small. but i can use it for 30 cm ? do it replay to me? again very tanks for your help .
    Dodano po 21 [minuty]:

    i change frequency=8000000 but again read t1=61423 and d1=61423 ? i think they are false value. but i dont know why?do i should hardware crystal 32.768k? i am testing in a room.

    0
  • #9 27 Maj 2013 16:52
    mahin2010
    Poziom 6  

    hi. i see when mosi or mclk sensor is free again t1=d1 but why? its noise? i dont know? and i see portb.5 mega32 is 10mv or 1.7mv?it is not small? help me please

    0
  • #10 27 Maj 2013 22:00
    LordBlick
    VIP Zasłużony dla elektroda

    Try to upload scheme.

    0
  • #11 28 Maj 2013 12:49
    mahin2010
    Poziom 6  

    [AVR][Bascom]barometr with hp02s

    hello and very thanks.
    Scheme corrected. LordBlick

    Moderowany przez LordBlick:

    Be patient for reply.

    0
  • #12 28 Maj 2013 13:08
    atom1477
    Poziom 43  

    In general You had an error in the timer settings. If you wanted pulses every 12 cycles you should enter not 12, but 256-12 = 244.
    But now it does not matter because you have to write 256-125 = 131, which is close to 125.
    You must check in Program Simulation how high is the MCLK frequency.

    0
  • #13 28 Maj 2013 23:59
    mahin2010
    Poziom 6  

    hi and thanks but i think clk puls is false. do i corect?its need 500Khz puls?i will change timer=131 and report for you.

    0
  • #14 29 Maj 2013 12:59
    atom1477
    Poziom 43  

    You need 32kHz.
    8MHz / 125 / 2 = 32000Hz.

    0
  • #15 31 Maj 2013 00:51
    mahin2010
    Poziom 6  

    hello. excusme i have another question? when i change sensor location do d1 and t1 should be change? do i corect think?

    0
  • #16 31 Maj 2013 15:01
    atom1477
    Poziom 43  

    Yes, d1 should change. t1 not necessarily.
    But look, d1 ald t1 is 61423. It is 0xEFEF.
    It's obvious look as a read error.
    I still guess that you have too small MCLK frequency. Did you check it in the simulation?

    EDIT.
    I checked it myself. Timer_isr takes 123 cycles. Far too long in order to it could work.
    It is necesary to convert it to the assembler.
    I guess that You didn't do it independent, so ... here: :D

    Kod: basic4gl
    Zaloguj się, aby zobaczyć kod


    Check if this work.

    Note: Nosave is very important.

    0
  • #17 01 Cze 2013 09:31
    mahin2010
    Poziom 6  

    I'm sorry i hurt you very much.I made some changes that you said.my value changed .d0=46170,t0=35393,p0=10127,s=340,c=298,d1=t1=61423,p=10212
    but I essentially Tsvrmyknm case I'm wrong ,I expected that when I change location of sensor(high or low) my value will change but perhaps I'm not going to use these sensors to control the room had a space robot, but maybe this is not the right
    .I'm going deside for 1 sensor when robot change her hands I control it. do you know sensor for my work? again very thanks for your help

    0
  • #18 01 Cze 2013 19:07
    atom1477
    Poziom 43  

    I think that there is no sensor that will do this. This is because the detection arm altitude (so small) with pressure is wrong.

    0