Hi Oliver,

OK, so it will be mm (word) and mil (dword). Sample output looks like this, see 
below. This is not yet with a module since I did not yet get it. I used another 
PIC to simulate the module.

Distance measured is: 25 mm or 1010 mil.
Distance measured is: 2.5 cm or 1.0 inch.

Distance measured is: 34 mm or 1350 mil.
Distance measured is: 3.4 cm or 1.3 inch.

Distance measured is: 58 mm or 2290 mil.
Distance measured is: 5.8 cm or 2.2 inch.

Distance measured is: 81 mm or 3180 mil.
Distance measured is: 8.1 cm or 3.1 inch.

Distance measured is: 95 mm or 3750 mil.
Distance measured is: 9.5 cm or 3.7 inch.

Distance measured is: 103 mm or 4060 mil.
Distance measured is: 10.3 cm or 4.0 inch.

Kind regards,

Rob


________________________________
Van: 'Oliver Seitz' via jallib <[email protected]>
Verzonden: zaterdag 30 september 2023 12:06
Aan: [email protected] <[email protected]>
Onderwerp: AW: Re: [jallib] English (function) question

Yes, otherwise you could use 1/16" or 1/32" which is near a mm, but it seems to 
be a bit of a strange unit for me.

byte*3 would suffice for the maximum range of 197000 mils, but I'm not sure if 
it's wise to use that... for 5000mm word is enough :-)

Greets,
Kiste

Gesendet von Yahoo Mail auf 
Android<https://mail.onelink.me/107872968?pid=nativeplacement&c=Global_Acquisition_YMktg_315_Internal_EmailSignature&af_sub1=Acquisition&af_sub2=Global_YMktg&af_sub3=&af_sub4=100000604&af_sub5=EmailSignature__Static_>

Am Sa., Sept. 30, 2023 at 11:49 schrieb Rob CJ
<[email protected]>:
Hi Kiste,

Thanks for the suggestion. Question about the mils. The modules resoluiton is 
limited (see screenshot below). What would 1/000 of an inch bring? Is it 
because of the standard terminology mils?

[cid:Td1Ro5YW9BV93yihGG4h]

So your suggestion would be the following?
function hcsr04_get_distance_mm() return dword is
function hcsr04_get_distance_mils) return dword is

Thanks.

Kind regards,

Rob

________________________________
Van: 'Oliver Seitz' via jallib <[email protected]>
Verzonden: zaterdag 30 september 2023 11:21
Aan: [email protected] <[email protected]>
Onderwerp: Re: [jallib] English (function) question

Hi Rob,

I wanted to suggest to name the functions after the return data type. I never 
use floats, so if I would have a function called "fine", it would return a 
length in mm (metric) or mils (=1/1000 inch imperial)

Even if you would return a length in micrometers, a dword would suffice for a 
range of over 4 kilometers, still by a smaller overhead than using a float.

Greets,
Kiste

Am Samstag, 30. September 2023 um 11:11:37 MESZ hat Rob CJ <[email protected]> 
Folgendes geschrieben:


Hi Vasile,

Thanks 🙂

I just came up with another idea. Using a float value makes the library big in 
ROM size (it easily adds 600 byte of ROM or more) and I only need one decimal.

So I have another idea and that is return the distance in mm. In that case I 
only need a word as return value.

So now I have only two functions:
function hcsr04_get_distance_mili_meter() return word is
function hcsr04_get_distance_mili_inch() return word is

I only do not know if mili-inch is an English term. Would like to know that.

Or should I use tens_of_cm and tens_of_inch?

Thanks.

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens vasi vasi 
<[email protected]>
Verzonden: zaterdag 30 september 2023 10:51
Aan: [email protected] <[email protected]>
Onderwerp: Re: [jallib] English (function) question

For a non-native English speaker like me, the function names are perfect!

On Sat, Sep 30, 2023 at 11:40 AM [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> wrote:
Hi all.

I have a question for English native speakers. I am working on a library for 
the HC-SR04 ultrasonic ranging module.

I have functions that return the distance in cm and inch.

My question is the following. One of the functions returns a word so the 
distance is without a decimal, so 2 cm, 5 inch, etc. The other function returns 
a float so the distance is with a decimal, so 3.5 cm, 5.1 inch.

I am looking for a good name for these functions. I now have the following 
names but I am wondering if there is a better name for them:

function hcsr04_get_distance_cm_coarse() return word is
function hcsr04_get_distance_inch_coarse() return word is
function hcsr04_get_distance_cm_fine() return float is
function hcsr04_get_distance_inch_fine() return float is

So I am looking for  a better name for these functions. Any suggestions?

Thanks.

Kind regards,

Rob




--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/655e1cd1-adaf-49d9-b645-9ddcef475248n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/655e1cd1-adaf-49d9-b645-9ddcef475248n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Vasi

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CABsDq%3D86Jh5W8jHyb8VdQvvOJbrin%2BEzLTHKnkOsfzbLsR7-XQ%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CABsDq%3D86Jh5W8jHyb8VdQvvOJbrin%2BEzLTHKnkOsfzbLsR7-XQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB163796241C555E0C1AB38BDBE6C7A%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jallib/GVXP195MB163796241C555E0C1AB38BDBE6C7A%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/1217217500.4864974.1696065700920%40mail.yahoo.com<https://groups.google.com/d/msgid/jallib/1217217500.4864974.1696065700920%40mail.yahoo.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB16376EEEE46CD40617176FB6E6C7A%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jallib/GVXP195MB16376EEEE46CD40617176FB6E6C7A%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/5733496.4871941.1696068379257%40mail.yahoo.com<https://groups.google.com/d/msgid/jallib/5733496.4871941.1696068379257%40mail.yahoo.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB16371290F498342AB52BBB7AE6C7A%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM.

Reply via email to