Help with basic Hal Component
01 Sep 2016 02:56 - 01 Sep 2016 04:17 #79808
by jwsigler
Help with basic Hal Component was created by jwsigler
I am trying to develop my own custom Hal components to interface between Linuxcnc and my mill. I wrote a very basic Hal Component in C, but can not get the component to compile. If someone can help debug my file I would greatly appreciate it. Once I can figure out how to get a basic Hal component file to work I should be able to build on it for more complex functions. I have included both the hal component file as well as the error messages I got when trying to compile it. I am running Linuxcnc 2.7.4.
custom Hal component
component drawbar2;
pin in bit clamp;
pin in bit unclamp;
pin io bit solenoid;
option singleton yes;
variable int dbstate;
function _;
license "GPL";
;;
FUNCTION(_)
{
if (!clamp) {
solenoid = false;
rtapi_print_msg(RTAPI_MSG_ERR, "DrawBar Clamped");
return;
}
if (unclamp) {
solenoid = true;
rtapi_print_msg(RTAPI_MSG_ERR, "DrawBar Unclamped");
return;
}
}
Compiling error messages
john@tree325 ~ $ sudo halcompile --install Drawbar2.comp
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1353, in <module>
main()
File "/usr/bin/halcompile", line 1322, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1192, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 417, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
custom Hal component
component drawbar2;
pin in bit clamp;
pin in bit unclamp;
pin io bit solenoid;
option singleton yes;
variable int dbstate;
function _;
license "GPL";
;;
FUNCTION(_)
{
if (!clamp) {
solenoid = false;
rtapi_print_msg(RTAPI_MSG_ERR, "DrawBar Clamped");
return;
}
if (unclamp) {
solenoid = true;
rtapi_print_msg(RTAPI_MSG_ERR, "DrawBar Unclamped");
return;
}
}
Compiling error messages
john@tree325 ~ $ sudo halcompile --install Drawbar2.comp
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1353, in <module>
main()
File "/usr/bin/halcompile", line 1322, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1192, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 417, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
Last edit: 01 Sep 2016 04:17 by jwsigler.
Please Log in or Create an account to join the conversation.
01 Sep 2016 05:42 #79812
by emcPT
Replied by emcPT on topic Help with basic Hal Component
Copy pasting your code compiled ok here.
Are you sure that you have the same name of the component and the file name?
Check if you did:
www.wiki.eusurplus.com/index.php?title=L...d_install_components
Are you sure that you have the same name of the component and the file name?
Check if you did:
www.wiki.eusurplus.com/index.php?title=L...d_install_components
Please Log in or Create an account to join the conversation.
01 Sep 2016 06:12 #79814
by jwsigler
Replied by jwsigler on topic Help with basic Hal Component
I thought that I had, but let me check it in the morning. The names were spelled the same, but there might have been a difference it capitalization. I forget that capitalization, or the lack there of, is important on a linux based machine.
It is good knowing that the component code compiled correctly.
It is good knowing that the component code compiled correctly.
Please Log in or Create an account to join the conversation.
Time to create page: 0.062 seconds