Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:29 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM and the HH10D

Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1873
Posted: 10:43pm 08 Jan 2012
Copy link to clipboard 
Print this post

Yes me again with another problem. I have a humidity sensor which gives out a frequency depending on humidity. I have it connected to pin 11. With no program in memory if I type into the keyboard;
SETPIN 11,3
PRINT PIN(11)
it gives me the frequency in Hz.
However if I write a two line program;
10 SETPIN 11,3
20 PRINT PIN(11)
RUN
it gives me a zero
Anyone know what I am doing wrong.
Paul.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3800
Posted: 10:47pm 08 Jan 2012
Copy link to clipboard 
Print this post

At a guess, not giving it time? Delay a little between the lines?
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1425
Posted: 11:40pm 08 Jan 2012
Copy link to clipboard 
Print this post

That should be it. In order to measure a frequency, you have to give the MM a chance to measure that frequency. I would suggest:


10 SETPIN 11,3
15 PAUSE 2000
20 PRINT PIN(11)
RUN

Micromites and Maximites! - Beginning Maximite
 
seco61
Senior Member

Joined: 15/06/2011
Location: Australia
Posts: 205
Posted: 11:58pm 08 Jan 2012
Copy link to clipboard 
Print this post

Hi Paul.

See the code that was posted in your original HH10D post.

Remember that the MMBasic code will execute approximately 30000 lines of code a second. The HH10D will have an output frequency of around 5 - 10kHz. In the time that MMBasic has executed 2 lines of code you will see a value of 0 or 1 returned. For an accurate frequency measurement you will need to wait at least a second between readings, and between setting the pin to frequency measurement and using the value.

Regards

Gerard (vk3cg/vk3grs)
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1873
Posted: 12:13am 09 Jan 2012
Copy link to clipboard 
Print this post

Thanks all, I now remember seeing that somewhere, problem solved.

Paul.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024