[chbot] HEX and ANSII ATMEGA and Delphi
Andrew Errington
erringtona at gmail.com
Mon Oct 26 00:51:53 GMT 2020
There are several ways to skin this particular cat, however, since you
are stuck on the annoying cases where you get a negative result I can
suggest two options.
1) When you get a negative result, fix it, because you know it can't
be negative.
2) Do you have access to ltoa() (long to ascii)? If so, put your
(unsigned) 16-bit value into a long and call ltoa().
Are you using the Arduino environment? You didn't say so explicitly,
but you did say you are using an ATmega of some type. If you post some
code (both sides) that could also help- it's hard to know what you
think is happening when you explain what you think is happening but
without showing the code. Then we can see what the code is doing and
suggest why it's not doing what you think it's doing.
This is a pretty simple problem, but it's easy to get bogged down in
the details if it's new to you.
Andrew
On 26/10/2020, Marshland Engineering <marshland at marshland.co.nz> wrote:
> Thanks for the replies. Some useful information.
>
> Basically I'm updating my Dyno hardware/software to include Drum and motor
> RPM, 02, Cylinder head and Exhaust Gas temperatures.
>
> All the figures will be +ve between 0 and 65535 and at sample rate of 10
> hz.
> Not rocket science but working on the Atmega is my equivalent of a Wasjig.
>
> I think I have it all sorted except for itoa which is int and not unsigned
> int.
>
> Can I modify my c libraries to make it unsigned or maybe just write my own
> function.
>
> Cheers Wallace.
More information about the Chchrobotics
mailing list