-
Posts
397 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Gallery
Blogs
Posts posted by MrKev
-
-
On 7/5/2020 at 9:35 AM, doezel said:
This is the relevant path; you want the complete VisualStudio Project?
private void tbdesiredODO_changed(object sender, EventArgs e)
{
if (int.TryParse(tbDesiredODO.Text, out int desiredODO))
{
int odoPart = desiredODO / 16;
int hexPart = 0xffff - odoPart;
List<int> hexArray = new List<int>();
for (int i = 0; i < 8; i++)
hexArray.Add(hexPart);
int remainder = (desiredODO - (odoPart * 16)) / 2;
for (int i = 0; i < remainder; i++)
hexArray--;
tbHex.Text = "";
for (int i = 0; i < 8; i++)
tbHex.Text += hexArray.ToString("X4") + " ";
lblStoredODO.Text = ((odoPart * 16) + (remainder * 2)).ToString();
}
else
{
tbHex.Text = "?";
lblStoredODO.Text = "?";
}
}sorry I only just got round to replying.
I would recommend uint (i.e. UInt16) rather than int to avoid complications with sign bits - not likely a problem till lots of miles though!
Otherwise your code seems fine - and I think the problem is probably endianness in the programmer - as I thnk you've already spotted.
I'm sure there must be a way to do this my mathematics rather than loops - but it has been a few years since I last looked, and I've not thought much about it in between.
Glad it's of use to people anyway!
Kevin
-
I would recommend some protection, for example a series resistor in the region of 220 Ohms in line from the supply, followed by a 15V or 18V Zener between the IC supply and ground - this will clamp any transient high voltages caused by wipers etc, to avoid damaging up the timer IC.
-
1
-
-
Can you post a link to your code?
-
Ok, i think its simpler to start with this: Take RATE, right shift 4 (/16), then logical AND with 0xFF, or 256 before wrapping the rest of the equation.
I haven't got a piece of paper handy, to work out the rest at the moment!
I think this will lead to a general rule for all rates, and satisfy the below 4096 case at the same time.
Kev
-
I meant 4096 >> 4
That better?
Kev
-
I'm kind of trying to get my brain switched back on to this, but it's been a while
@TSD: I think you're basically right with the observation that -11 is the equivalent of +5.
The /16 (or shift 4 places) does seem to tie up with the "4096" thing, as the top bit may become the sign/carry flag for an 8 bit micro: i.e. 4096 <<4 = 256 or 0 with carry.
Kev
-
1
-
-
Nice. It's been a while since we did this - good to see it's proving useful!
Kev
-
You need the bolt on the top, not the side to catch the movement in the hitch when the nose unweights. The side nut is for removing side to side play.
Kev
-
-
I've always understood this to be the case, but the introduction of computerised records 'instant' update meant that you now flagged as failed, whereas the old paper system meant it took time for anyone official to realise. I don't of course condone that philosophy as safe practice...
-
There's a Guide to servicing the switches in the tech archive.
Kev
-
I think I'll try it...
-
Ah good: "Published on May 1, 2014" - we did get there first
Kev
-
I found a PZ4 bit to be just the right size by the way.
Kev
-
It's quite easy, and no cutting bits of 5mm plate required. Just drilling the required hole, I also wired in the heated mirrors.
https://m.flickr.com/#/photos/mrkev/5481503123/
Kev
-
It could be the clutch fork is about to punch through. Give it another week or two and you'll no for certain..
Kev
-
1
-
-
What colour?
-
I just saw these on your facebook... I replaced mine about a week ago
!!!
-
That looks quite tidy - you appear to be able to get to the other end.
-
Confirmed, 16mm on mine. 5/8th is loose, though 3/4 pins are easy to buy, I'd consider drilling mine out if I loose the 16mm pin.
Kevin
-
Spotted on the A303 today I believe! Looking good.
Kev
-
Thanks for the heads up. I often find myself wanting a bit more than my cheap 200Nm offers. May have to pay them a visit.
-
fair point!
-
All I can think is the steering wheel may have jumped a couple splines when I initially tightened the drop arm nut and realised all that was holding it was the steering lock
Well, the steering lock locks the steering column, not at the wheel itself...
Kev
TD5 Speedo Mileage run up circuit
in Defender Forum (1983 - 2016)
Posted · Edited by MrKev
assuming tmpval is "int"
tmpval = (RATE / 16) & 0x8003 // preserving the sign bit, to save the if later on
then no need for the "if" block, just have:
checkword = ((((offset + tmpval) * 2) % 8 + 0x05) << 4