LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to develop HAL?

I need to develop a HAL for my new project. I have already looked into the documentation and resources available from NI and the community but my LabVIEW knowledge isn't enough it seems. The best I can do at the moment is to develop a QMH. But looking at the examples provided here:

 

https://forums.ni.com/t5/Example-Program-Drafts/Applying-Common-Object-Oriented-OO-Design-Patterns-t...

 

Makes me wonder how can I get to such level!

 

The presenations and the examples are made for someone who has in-depth programming experience or has already played around with the implementation of HAL. I however has none of that and would like to know what are the steps I need to follow, in order to be able to develop a HAL for my project. A question I would like to be answered is whether I need an extensive knowledge of OOP or not?

 

0 Kudos
Message 1 of 5
(4,255 Views)

I wouldn't say you need extensive OO knowledge but you will definitely need to understand the basics of inheritance.

 

None of the patterns in that link are required to implement a HAL but Factory is a good way to load the particular implementation class for the abstraction so it wouldn't hurt to look through that one.

 

Taking a step back, we're you told to implement a HAL or are you thinking that is the solution to some other problem?

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 5
(4,222 Views)

Your comment kind of points out how clueless I was on my search Smiley Very Happy

 

Anyways, I have been told to implement a HAL. The project is about developing a test bench which is made out of several power supplies, switches, measuerment devices (voltage, current, resistance, temperature, pressure...etc), sensors for safety and warning alarm, touch panel, all connected to cRIO.

 

I would normally use something similar to what is done in this example:

https://forums.ni.com/t5/Example-Program-Drafts/LabVIEW-Real-Time-Sample-Template-Embedded-UI/ta-p/3...

 

But my supervisor believes this is a wrong approach and would like to implement an HAL. Problem is that neither of us has that wide knowledge and experience in LabVIEW, beside a simple QMH. Which made me believe the examples I posted previously were somehow connected! As I have been doing research on LVOOP, which led me to those design patterns.

 

In fact I looked at this example:

http://www.ni.com/example/31307/en/

 

And kind of understand the underlying theory behind it, which seems simple, yet not telling the whole story of developing a HAL perhaps? Because then there is this example:

 

https://forums.ni.com/t5/LabVIEW-Development-Best/Measurement-Abstraction-Plugin-Framework-with-Opti...

 

Which is incomprehensible for me Smiley LOL

0 Kudos
Message 3 of 5
(4,209 Views)

I am still looking for answers as I am unable to solve the problem.

 

I want in general to develop an application for continuous data acquisition, measurement and control. I normally would use a QMH for this purpose, but since I have to develop a Hardware abstraction layer as well, I don't know how to incorporate both in my application.

 

I understand how to develop a HAL in general based on some examples on the net. I basically define a parent class for a hardware type and put all relevent hardware below it as childs. Define general methods for all hardware of this type under the parent and specific methods for each specific hardware. I can do this for all measurement devices, sensors, actuators..etc But how to incorporate this in a QMH is what I am unable to figure out. Unless there is another method which I don't know of.

0 Kudos
Message 4 of 5
(4,105 Views)

Just an initial starting thought:

 

What comes immediately to mind is that the many of the parent-level generic HAL functions sound they'd like map directly to QMH messages.  Let's say you have a HAL for power supplies with parent-level functions "Set Voltage", "Set Current Limit", "Enable Output".  I picture a QMH message loop with cases for those exact messages.  Inside each case is the corresponding generic parent-level function.

 

Then you just need to decide which part of the code is responsible for instantiating the specific child object(s) for your app.  There are arguments for doing the instantiation inside the QMH message loop for the power supply to better encapsulate your code.  It is sometimes more straightforward though to do more of the initialization work globally and then distribute the objects to the appropriate message loops.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 5 of 5
(4,094 Views)