RCTIME value and non-integer math
Archiver
Posts: 46,084
Thanks for previous help guys.
I had a problem bringing in some serial data and found that the device I was
using to convert Iloop to RS232 was building up static and since I didn't
have my BS2's GND tied to the converter, they would eventually stop talking
to each other!
Thanks again....I'll sort the details out later....
to me next issue...
I've moved to interfacing to a different wind system.
This one is easier in comparison.
A 12K pot is used for direction and a magnet on a shaft for the Wind speed.
So, my issue at hand is trying to keep as much resolution as possible.
For that I need the use of decimal places...and I know y'all hate answering
this one!
I use RCTIME and have gotten it to return my value of resistance for the
given direction. FINE...no problem (whew)!
Now I have to do something with this value to figure out the direction.
At 360degrees I have 1170 returned by RCTIME. There's a 5degree deadband
between 355 and 360 (give or take).
SO.... 1170/360 = 3.25 So, that means for every degree there's a 3.25
change in RCTIME count. NOW, since it's actualy 11700ohms it's really a
change of 32.5ohm for each degree.
I need to take that 1170 (or 11700) and divide by my resolution (3.25 or
32.5). I tried multiplying by 100 then dividing by 100...but I end up
dropping my 1's and end up with a 10degree resolution.
Got tips for me? OH YA...also, my RCTIME count is about 80 for 5deg and
goes up with my angle.
All help is appreciated....me thinks I had too much thanksgiving turkey
gravy and me head is too slow!
sb
I had a problem bringing in some serial data and found that the device I was
using to convert Iloop to RS232 was building up static and since I didn't
have my BS2's GND tied to the converter, they would eventually stop talking
to each other!
Thanks again....I'll sort the details out later....
to me next issue...
I've moved to interfacing to a different wind system.
This one is easier in comparison.
A 12K pot is used for direction and a magnet on a shaft for the Wind speed.
So, my issue at hand is trying to keep as much resolution as possible.
For that I need the use of decimal places...and I know y'all hate answering
this one!
I use RCTIME and have gotten it to return my value of resistance for the
given direction. FINE...no problem (whew)!
Now I have to do something with this value to figure out the direction.
At 360degrees I have 1170 returned by RCTIME. There's a 5degree deadband
between 355 and 360 (give or take).
SO.... 1170/360 = 3.25 So, that means for every degree there's a 3.25
change in RCTIME count. NOW, since it's actualy 11700ohms it's really a
change of 32.5ohm for each degree.
I need to take that 1170 (or 11700) and divide by my resolution (3.25 or
32.5). I tried multiplying by 100 then dividing by 100...but I end up
dropping my 1's and end up with a 10degree resolution.
Got tips for me? OH YA...also, my RCTIME count is about 80 for 5deg and
goes up with my angle.
All help is appreciated....me thinks I had too much thanksgiving turkey
gravy and me head is too slow!
sb
Comments
The conversion factor you are looking for is 1/3.25 = 0.3077. The
Stampish way to approximate that is as 0.3077 = 20165/65536. The
division by 65536 is implied in the ** operator.
Just as a side point, it might be good to include a fixed resistor in
series with the 12k pot, so as to avoid a large charging current when
the wind direction pot resistance = zero. Say, 1k ohms. That would
complicate the math a little bit with an RCtime offset when degrees=0.
-- Tracy
>to me next issue...
>I've moved to interfacing to a different wind system.
>This one is easier in comparison.
>A 12K pot is used for direction and a magnet on a shaft for the Wind speed.
>
>So, my issue at hand is trying to keep as much resolution as possible.
>For that I need the use of decimal places...and I know y'all hate answering
>this one!
>
>I use RCTIME and have gotten it to return my value of resistance for the
>given direction. FINE...no problem (whew)!
>Now I have to do something with this value to figure out the direction.
>At 360degrees I have 1170 returned by RCTIME. There's a 5degree deadband
>between 355 and 360 (give or take).
>
>SO.... 1170/360 = 3.25 So, that means for every degree there's a 3.25
>change in RCTIME count. NOW, since it's actualy 11700ohms it's really a
>change of 32.5ohm for each degree.
>
>I need to take that 1170 (or 11700) and divide by my resolution (3.25 or
>32.5). I tried multiplying by 100 then dividing by 100...but I end up
>dropping my 1's and end up with a 10degree resolution.
>
>Got tips for me? OH YA...also, my RCTIME count is about 80 for 5deg and
>goes up with my angle.
I got a 220ohm resistor to the input pin.
I'll have to give that all a try tonight.
Cheers
Original Message
From: Tracy Allen [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=VuIN3ikLhqTXPJxCl-N0-fcqP3UpFCo_7Sil9vIpH4OrJvEyHJKcm2ZBz-27gBa-OXKU8YiWTmbTdiY]tracy@e...[/url
Sent: October 13, 2003 21:47
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] RCTIME value and non-integer math
degrees = RCtimeValue ** 20165
The conversion factor you are looking for is 1/3.25 = 0.3077. The
Stampish way to approximate that is as 0.3077 = 20165/65536. The
division by 65536 is implied in the ** operator.
Just as a side point, it might be good to include a fixed resistor in
series with the 12k pot, so as to avoid a large charging current when
the wind direction pot resistance = zero. Say, 1k ohms. That would
complicate the math a little bit with an RCtime offset when degrees=0.
-- Tracy
>to me next issue...
>I've moved to interfacing to a different wind system.
>This one is easier in comparison.
>A 12K pot is used for direction and a magnet on a shaft for the Wind
>speed.
>
>So, my issue at hand is trying to keep as much resolution as possible.
>For that I need the use of decimal places...and I know y'all hate
>answering this one!
>
>I use RCTIME and have gotten it to return my value of resistance for
>the given direction. FINE...no problem (whew)! Now I have to do
>something with this value to figure out the direction. At 360degrees I
>have 1170 returned by RCTIME. There's a 5degree deadband between 355
>and 360 (give or take).
>
>SO.... 1170/360 = 3.25 So, that means for every degree there's a 3.25
>change in RCTIME count. NOW, since it's actualy 11700ohms it's really
>a change of 32.5ohm for each degree.
>
>I need to take that 1170 (or 11700) and divide by my resolution (3.25
>or 32.5). I tried multiplying by 100 then dividing by 100...but I end
>up dropping my 1's and end up with a 10degree resolution.
>
>Got tips for me? OH YA...also, my RCTIME count is about 80 for 5deg and
>goes up with my angle.
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/