new HP-IL software implementation in C++20
|
06-01-2024, 05:50 AM
(This post was last modified: 06-01-2024 03:54 PM by brouhaha.)
Post: #6
|
|||
|
|||
RE: new HP-IL software implementation in C++20
Thanks! This might eventually be useful as a reference, but it won't be suitable to run on small microcontroolers as the memory footprint is fairly large. Part of that might be due to use of some STL containers, which I don't really need. However, in general I think HP's app note on HP-IL device design is a better guide for designing non-controller devices that use a 1LB3 (or later equivalents).
I worked very hard to get the configuration to be generated statically, using C++ templates with constexpr, etc., so that the compiler can leave out all code paths not needed. For instance, a very basic non-controller device would have its configuration statically generated at compile time from an HP-IL capabilities string and a few more parameters. In the following example, an HP-IL interface configuration is created for a "Fidget" electronic instrument that supports talk, receive, service request, extended (secondary) addressing, remote-local, parallel clear, and device trigger. Code:
Since the configuration is "constexpr" (which required quite a bit of template trickery under the hood), the HP-IL capabilities string is parsed at compile time, and the structure is static (ROMable). Each HP-IL interface function has a bitfield in the hpil::Configuration, so in this example, fidget_config.c[0], fidget_config.t[3], and fidget_config.sr[1] are true, but fidget_config.c[1], fidget_config.t[5], fidget_config.l[2], and fidget_config.dd[1] are false. The HP-IL "interface" is then instantiated using that configuration. Here is an example of creating a fidget interface: Code:
The configuration is used as a template parameter, which means that the HP-IL interface code will be compiled for exactly the configuration needed, with none of the code needed to support capabilities that aren't used. In this example, the C (controller), PD1 (power down command), and DD1 (device dependent talker/listener) code will be omitted, as will many of the state transition tests and actions. Note that there could potentially be mroe than one HP-IL interface of type "fidget" in the same program, or HP-IL interfaces of different configurations. I certainly understand some aspects of HP-IL much better than I did previously. Once I've debugged it enough that it might be worthwhile, I'll put it on github, and post a link here. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
new HP-IL software implementation in C++20 - brouhaha - 05-25-2024, 11:09 PM
RE: new HP-IL software implementation in C++20 - MeindertKuipers - 05-30-2024, 08:48 AM
RE: new HP-IL software implementation in C++20 - brouhaha - 06-01-2024 05:50 AM
RE: new HP-IL software implementation in C++20 - Martin Hepperle - 05-30-2024, 11:52 AM
RE: new HP-IL software implementation in C++20 - J-F Garnier - 05-30-2024, 01:08 PM
RE: new HP-IL software implementation in C++20 - J-F Garnier - 05-30-2024, 03:24 PM
|
User(s) browsing this thread: 1 Guest(s)