[chbot] HEX and ANSII ATMEGA and Delphi

Andrew Starr ajstarr at gmail.com
Sun Oct 25 23:39:07 GMT 2020


If you are sending a bunch of values, instead of just one, then something
like base64 might be worth considering. If you had (for example) a struct
containing all your sensor values, you could base64 encode it and send it
as a line of ASCII text. If there's no decoder for Delphi already, find the
C source and port it (there's not much to it)

On Mon, Oct 26, 2020, 12:08 PM 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.
>
>
>
>
>
>
> --
> Thanking you
> Wallace Weideman
> Marshland Engineering
> 704 Marshland Road
> Styx
> Christchurch
> 03 3237449
> www.marshland.co.nz
>
>
>
> On 25/10/2020 at 3:01 p.m., chchrobotics-request at lists.ourshack.com wrote:
> >Send Chchrobotics mailing list submissions to
> >       chchrobotics at lists.ourshack.com
> >
> >To subscribe or unsubscribe via the World Wide Web, visit
> >       https://lists.ourshack.com/mailman/listinfo/chchrobotics
> >or, via email, send a message with subject or body 'help' to
> >       chchrobotics-request at lists.ourshack.com
> >
> >You can reach the person managing the list at
> >       chchrobotics-owner at lists.ourshack.com
> >
> >When replying, please edit your Subject line so it is more specific
> >than "Re: Contents of Chchrobotics digest..."
> >
> >
> >Today's Topics:
> >
> >   1. Mantraps, security etc. (Mark Atherton)
> >   2. Re: High voltage batteries and electrolytic capacitors
> >      (Andy Gardner)
> >   3. int > ascii > int (Bevin Brett)
> >
> >
> >----------------------------------------------------------------------
> >
> >Message: 1
> >Date: Sun, 25 Oct 2020 13:41:43 +1300
> >From: Mark Atherton <markaren1 at xtra.co.nz>
> >To: chchrobotics at lists.ourshack.com
> >Subject: [chbot] Mantraps, security etc.
> >Message-ID: <35e4c553-24d2-4370-8761-0fdd037086a4 at xtra.co.nz>
> >Content-Type: text/plain; charset=utf-8; format=flowed
> >
> >I doubt if an electrified razor-wire fence would be considered any form
> >of a trap if you had suitable warnings. Take a look at "Holland's Suzuki
> >Cars, 4 Shakespeare Road, Waltham". From street-view the electrification
> >signs on the fence are visible as yellow rectangles.
> >
> >If I were interested in tightening up security of a property in an
> >enthusiastic manner, I would talk to the police first. Possibly by
> >inviting them around to advise.
> >
> >What was the result of the burglary ?
> >
> >-mark
> >
> >
> >
> >
> >On 25/10/2020 11:40 AM, Henri Shustak wrote:
> >> Hello,
> >>
> >> Thank you for the reply. I am wondering would this apply to something
> like
> barbed wire to make getting in/out of a property more difficult? If someone
> got injured by trying to get over it?
> >>
> >> Just had a problem with a drone overhead and then a week later (possibly
> unrelated) someone in a group entering the property by climbing the fence.
> Hence my questions.
> >>
> >> Your information has been super useful.
> >>
> >> Sorry to hijack this thread.
> >>
> >> Henri
> >>
> >>> On 25/10/2020, at 11:34 AM, Mark Atherton <markaren1 at xtra.co.nz>
> wrote:
> >>>
> >>> 202 Setting traps, etc
> >>>
> >>> (1) Every one is liable to imprisonment for a term not exceeding 5
> years
> who, with intent to injure, or with reckless disregard for the safety of
> others, sets or places or causes to be set or placed any trap or device
> that
> is likely to injure any person.
> >>>
> >>> (2) Every one is liable to imprisonment for a term not exceeding 3
> years
> who, being in occupation or possession of any place where any such trap or
> device has been set or placed, knowingly and wilfully permits it to remain
> there in such a condition that any person is likely to be injured by it.
> >>>
> >>>
> http://www.legislation.govt.nz/act/public/1961/0043/137.0/DLM329707.html
> >>>
> >>>
> >>> On 25/10/2020 11:30 AM, Henri Shustak wrote:
> >>>> Hi I am actually looking right now at what these laws are if anyone
> can
> explain in simple terms that would be great. Basically, are you responsible
> for trespassing people injuring themselves on your property? Any links
> would
> be welcomed. I have not had any luck finding the details or even an
> overview.
> >>>>> Damn that mantrap law.
> >>>>>
> >>>>> On 5/10/20 7:37 pm, Mark Atherton wrote:
> >>>>>> I was about to express concern about the type of insulator that your
> coffee table is constructed from (mica ?), but on second thoughts I might
> be
> better off asking if you charge the unit before going to bed at night.
> Might
> be good at catching burglars :)
> >>>
> >
> >
> >
> >------------------------------
> >
> >Message: 2
> >Date: Sun, 25 Oct 2020 14:33:35 +1300
> >From: Andy Gardner <ceo at andygardner.com>
> >To: chchrobotics at lists.ourshack.com
> >Subject: Re: [chbot] High voltage batteries and electrolytic
> >       capacitors
> >Message-ID: <9ed093b6-4ba0-20c5-7a5e-b9a876df1b25 at andygardner.com>
> >Content-Type: text/plain; charset=utf-8; format=flowed
> >
> >
> >
> https://ccc.govt.nz/consents-and-licences/resource-consents/residential-and-housing/property
> >
> >####
> >
> >Barbed wire or razor wire fences
> >
> >The Council Public Places Bylaw 2018 states that barbed wire, razor wire
> or
> electrified wire may not be used within one metre of any property boundary
> adjoining any public place, unless the wire is at a height of 2.5m or more
> above ground level, or the public place is in a rural area. Internal
> boundary
> fences are covered by the Fencing Act 1978.
> >
> >If the height of the fence is over 2.5m, a resource consent and a building
> consent will be required. Therefore it is recommended that you contact the
> the
> Duty Planner on 03 941 8999 if your proposed fence is over this height.
> >
> >####
> >
> >
> >
> >On 25/10/20 11:40 am, Henri Shustak wrote:
> >> Hello,
> >>
> >> Thank you for the reply. I am wondering would this apply to something
> like
> barbed wire to make getting in/out of a property more difficult? If someone
> got injured by trying to get over it?
> >>
> >> Just had a problem with a drone overhead and then a week later (possibly
> unrelated) someone in a group entering the property by climbing the fence.
> Hence my questions.
> >>
> >> Your information has been super useful.
> >>
> >> Sorry to hijack this thread.
> >>
> >> Henri
> >>
> >>> On 25/10/2020, at 11:34 AM, Mark Atherton <markaren1 at xtra.co.nz>
> wrote:
> >>>
> >>> 202 Setting traps, etc
> >>>
> >>> (1) Every one is liable to imprisonment for a term not exceeding 5
> years
> who, with intent to injure, or with reckless disregard for the safety of
> others, sets or places or causes to be set or placed any trap or device
> that
> is likely to injure any person.
> >>>
> >>> (2) Every one is liable to imprisonment for a term not exceeding 3
> years
> who, being in occupation or possession of any place where any such trap or
> device has been set or placed, knowingly and wilfully permits it to remain
> there in such a condition that any person is likely to be injured by it.
> >>>
> >>>
> http://www.legislation.govt.nz/act/public/1961/0043/137.0/DLM329707.html
> >>>
> >>>
> >>> On 25/10/2020 11:30 AM, Henri Shustak wrote:
> >>>> Hi I am actually looking right now at what these laws are if anyone
> can
> explain in simple terms that would be great. Basically, are you responsible
> for trespassing people injuring themselves on your property? Any links
> would
> be welcomed. I have not had any luck finding the details or even an
> overview.
> >>>>> Damn that mantrap law.
> >>>>>
> >>>>> On 5/10/20 7:37 pm, Mark Atherton wrote:
> >>>>>> I was about to express concern about the type of insulator that your
> coffee table is constructed from (mica ?), but on second thoughts I might
> be
> better off asking if you charge the unit before going to bed at night.
> Might
> be good at catching burglars :)
> >>>
> >>>
> >>> _______________________________________________
> >>> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> >>> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> >>> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> >>> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue,
> directions and dates.
> >>> When replying, please edit your Subject line to reflect new subjects.
> >>
> >>
> >> _______________________________________________
> >> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> >> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> >> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> >> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue,
> directions and dates.
> >> When replying, please edit your Subject line to reflect new subjects.
> >>
> >
> >
> >
> >------------------------------
> >
> >Message: 3
> >Date: Sun, 25 Oct 2020 02:00:55 +0000
> >From: Bevin Brett <bevin_brett at hotmail.com>
> >To: "chchrobotics at lists.ourshack.com"
> >       <chchrobotics at lists.ourshack.com>
> >Subject: [chbot] int > ascii > int
> >Message-ID:
> >       <
> MW3PR12MB4491AFB7B04BA98898DD064A93180 at MW3PR12MB4491.namprd12.prod.outlook.com
> >
> >
> >Content-Type: text/plain; charset="iso-8859-1"
> >
> >Ok, assuming you are NOT going to use some standard library, here are the
> issues and some code
> >
> >Let us first discuss getting the character string from one machine to the
> other.
> >Either (a) it is fixed length,  or (b) you put a size on the beginning, or
> (c) you put a flag at the end
> >Fixed length is easiest, and least efficient.
> >Size is only best if the length is very long - its not going to be here.
> >So instead we need a flag at the end.  Lets do that - we will discuss how
> in
> a minute.
> >
> >So assuming that the characters arrive one at a time you get some receiver
> code that  looks like
> >
> >    int i = 0;
> >    while  (getNextChar(&c)) {
> >       adjust i using c
> >    }
> >
> >Next problem.  What characters can you send.   Can you send ANY
> (0x00..0xff)
> character, or does the h/w and s/e connecting the two ends stop you from
> using
> NUL (0x00)?  CR? LF? Ctrl-S? Ctrl-Q?  others?.    Let's assume that you can
> only send printable chars ' '..'~'.
> >
> >   char firstSendableChar = ' ';
> >   char lastSendableChar = '~';
> >   int nSendableChars = ((int)(lastSendableChar) -
> (int)(lastSendableChar)) +
> 1;
> >
> >Now the basic idea, we are going to have to improve it, is to do this at
> the
> transmitting end
> >
> >   int val = <the number to send>
> >
> >   while (val > 0) {
> >       char toSend = val % nSendableChars;      // these two lines are the
> crux of the solution
> >       val                 = val / nSendableChars;
> >       send((char)(toSend + firstSendableChar ))
> >   }
> >
> >
> >  int i = 0;
> >  while  (getNextChar(&c)) {
> >       i = i*nSendableChars + (c - firstSendableChar);
> >  }
> >
> >Okay, so now we only have two problems.  (a) negative numbers, and (b)
> knowing when to stop.
> >
> >You could just do the above using unsigned int, and use
> >    unsigned int unsignedIntermediate = (unsigned int)(input);
> >    ...
> >   send and receive
> >   ...
> >    int output = (int) unsignedIntermediate;
> >and the only problem with that is -small is a very long this way.
> >
> >A better approach is to send the sign bit similarly to sending the count.
> >
> >The second problem is that there is no positive number corresponding to
> the
> most negative number, so you can't just do
> >    int sign = (value > 0);
> >    if (sign) value = -value;
> >Instead you have to do
> >    if (!sign) value = -value;
> >
> >Now the above loop using % and / requires understanding how those
> operations
> work with -ve numbers.
> >
> >How to send the sign and end-of-number bits?  One thing to do place them
> both
> in the last character.  To do this,
> >reduce the
> >
> >  int nDigitChars = nSendableChars / 2;
> >
> >Now we can code the above loop
> >
> > while (val > 0) {
> >       int    nextVal = val / nDigitChars ;
> >       char toSend = val % nDigitChars ;      // these two lines are the
> crux
> of the solution
> >       if (nextVal == 0) toSend += nDigitChars ;
> >       val                 = nextVal ;
> >       send((char)(toSend + firstSendableChar ))
> >   }
> >
> >and the receive loop
> >
> >  int i = 0;
> >  while  (getNextChar(&c)) {
> >       int atEnd = (c >= nDigitChars );
> >       if (atEnd) c -= nDigitChars ;
> >       i = i*nDigitChars + (c - firstSendableChar);
> >       if (atEnd) break;
> >  }
> >
> >I'll leave it as an exercise to the reader to place the sign bit in the
> last
> sent character.
> >
> >I'm not sure the complexity of the above is worth it.
> >
> >Those % and / are expensive.  There are faster ways than the above - I
> spent
> a few months working on the integer to/from string in the 1990's because
> believe it or not it is an important operation in telephone systems.
> >
> >/Bevin
> >-------------- next part --------------
> >An HTML attachment was scrubbed...
> >URL:
> <
> http://lists.ourshack.com/pipermail/chchrobotics/attachments/20201025/a75132ba/attachment.html
> >
> >
> >------------------------------
> >
> >Subject: Digest Footer
> >
> >_______________________________________________
> >Chchrobotics mailing list
> >Chchrobotics at lists.ourshack.com
> >https://lists.ourshack.com/mailman/listinfo/chchrobotics
> >Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> >Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue,
> directions and dates.
> >Please edit your Subject line to reflect new subjects.
> >
> >------------------------------
> >
> >End of Chchrobotics Digest, Vol 157, Issue 22
> >*********************************************
>
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20201026/b75fd703/attachment-0001.html>


More information about the Chchrobotics mailing list