Human Friendly Control Protocol (HFCP)

Forum dedicated to discussions of articles by Jon Williams, columnist, author and contributing editor to Nuts and Volts magazine sine 1994. This is the place to ask questions and get errata on Spin Zone columns and a place to converse directly with Jon.

Moderator: jonnymac

Post Reply
redrocker
Posts: 88
Joined: Fri Oct 29, 2004 12:01 am
Location: Pennsylvania
Contact:

Human Friendly Control Protocol (HFCP)

Post by redrocker » Sat May 26, 2012 9:52 am

I am not 100% sure about this, because I do not have the hardware to test it, but I am pretty sure I found some bugs in the code. Let me just start with one:

In function write(), it fails to clear the 'ptype' and 'pwidth' array elements. If one were to request one of the non-default (non-decimal) data types first - for example, hexadecimal - those two arrays would have non-zero values in the corresponding elements. If subsequently, one were to request a default (decimal) type, the logic in function build_msg() will fail, and pick the wrong format type. It can be fixed by additionally clearing the corresponding array elements in function write().

User avatar
jonnymac
Posts: 4
Joined: Fri Jan 13, 2006 1:01 am
Location: Burbank, CA
Contact:

Re: Human Friendly Control Protocol (HFCP)

Post by jonnymac » Mon Jan 20, 2014 1:33 pm

Sorry, I haven't visited these boards in ages as I tend to hang out in the official Propeller forums on Parallax.

Having read and considered your comments, I believe you may be correct. HFCP is in use in a commercial system without issues, and I'm presently designing it into another -- this gives me the opportunity to make fixes and improvements.

I don't think any of us have been caught out by the [possible] error because we're using decimal values which is the default format.

This will sort things -- and was probably what I intended (hence two variations on write).

Code: Select all

pub write(pnum, value)

'' Writes decimal value to numeric parameter

  writex(pnum, value, P_DEC, 0)                                 ' decimal, variable width
Thanks for your keen eye.
JonnyMac
Hollywood, CA

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests