Help needed to get my 7i76E + 7i85S + 7i73 on my mill going.

More
30 Aug 2018 07:29 #116838 by tecno
Halts in compile

bengt@debian:~/linuxcnc$ sudo halcompile --compile GB_2speed.comp
[sudo] password for bengt:
GB_2speed.comp:17:25: Array name contains no #: 'message'
> pin out bit message[14];
> ^
bengt@debian:~/linuxcnc$

Where in the compfile should a message be written and how?

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 13:19 #116851 by andypugh

GB_2speed.comp:17:25: Array name contains no #: 'message'
> pin out bit message[14];
> ^


That needs to be
pin out bit message-##[14]

Where in the compfile should a message be written and how?

"message" is an existing and separate HAL component.

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 13:22 #116853 by tecno

GB_2speed.comp:17:25: Array name contains no #: 'message'
> pin out bit message[14];
> ^


That needs to be
pin out bit message-##[14]

Where in the compfile should a message be written and how?

"message" is an existing and separate HAL component.


Next issues

bengt@debian:~/linuxcnc$ sudo halcompile --compile GB_2speed.comp
[sudo] password for bengt:
make KBUILD_EXTRA_SYMBOLS=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-3.4-9-rtai-686-pae SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Entering directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
CC [M] /tmp/tmpqqABfe/GB_2speed.o
GB_2speed.comp: In function ‘_’:
GB_2speed.comp:28:2: warning: overflow in implicit constant conversion [-Woverflow]
GB_2speed.comp:28:109: error: expected ‘}’ before ‘)’ token
GB_2speed.comp:28:109: error: expected ‘,’ or ‘;’ before ‘)’ token
GB_2speed.comp:32:12: error: ‘high_gear’ undeclared (first use in this function)
GB_2speed.comp:32:12: note: each undeclared identifier is reported only once for each function it appears in
GB_2speed.comp:32:31: error: ‘motor’ undeclared (first use in this function)
GB_2speed.comp:32:37: error: ‘high’ undeclared (first use in this function)
GB_2speed.comp:33:31: error: invalid operands to binary > (have ‘double’ and ‘int *’)
GB_2speed.comp:38:3: error: ‘message’ undeclared (first use in this function)
GB_2speed.comp:25:14: warning: unused variable ‘reqd’ [-Wunused-variable]
make[4]: *** [/tmp/tmpqqABfe/GB_2speed.o] Fel 1
make[3]: *** [_module_/tmp/tmpqqABfe] Fel 2
make[2]: *** [sub-make] Fel 2
make[1]: *** [all] Fel 2
make[1]: Leaving directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
make: *** [modules] Fel 2
bengt@debian:~/linuxcnc$

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 13:41 #116854 by tecno
Found some typos

bengt@debian:~/linuxcnc$ sudo halcompile --compile GB_2speed.comp
[sudo] password for bengt:
make KBUILD_EXTRA_SYMBOLS=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-3.4-9-rtai-686-pae SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Entering directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
CC [M] /tmp/tmpDjMcv7/GB_2speed.o
GB_2speed.comp: In function ‘_’:
GB_2speed.comp:28:2: warning: overflow in implicit constant conversion [-Woverflow]
GB_2speed.comp:33:31: error: invalid operands to binary > (have ‘double’ and ‘int *’)
GB_2speed.comp:38:3: error: ‘message’ undeclared (first use in this function)
GB_2speed.comp:38:3: note: each undeclared identifier is reported only once for each function it appears in
GB_2speed.comp:25:14: warning: unused variable ‘reqd’ [-Wunused-variable]
make[4]: *** [/tmp/tmpDjMcv7/GB_2speed.o] Fel 1
make[3]: *** [_module_/tmp/tmpDjMcv7] Fel 2
make[2]: *** [sub-make] Fel 2
make[1]: *** [all] Fel 2
make[1]: Leaving directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
make: *** [modules] Fel 2
bengt@debian:~/linuxcnc$

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 13:49 #116857 by andypugh
You could at least _try_ to fix some of the reported errors.

Try this, I think a lot were caused by the wrong type of bracket on line 28. (as hinted by "GB_2speed.comp:28:109: error: expected ‘}’ before ‘)’ token")
Attachments:

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 13:52 #116858 by tecno
Trying my best Andy, that line is already fixed.

component GB_2speed;

pin in bit spindle-enable-in;
pin out bit spindle-enable-out;
pin in float spindle-speed-in;
pin out float motor-speed-out;

pin in bit gear-high;
pin in bit motor-high;
pin in bit gear-A;
pin in bit gear-B;
pin in bit gear-C;
pin in bit gear-D;
pin in bit gear-E;

pin out unsigned gear-required;
pin out bit message-##[14];

license "gpl";
function _;

;;

FUNCTION(_){
int actual, reqd;
int i;
// These need to be edited to suit the gearbox
int speeds[15] = {0, 80, 125, 160, 215, 270, 360, 450, 595, 750, 1000, 1191, 1500, 2500, 1e99};
int reqd_gear[15] = {0x0, 0x01, 0x21, 0x02, 0x22, 0x04, 0x24, 0x08, 0x28, 0x10, 0x48, 0x68, 0x50, 0x70, 0x0};

if (spindle_speed_in == 0) return;
actual = (gear_high * 0x40 + motor_high * 0x20 + gear_A * 0x10 + gear_B * 0x08 + gear_C * 0x04 + gear_D * 0x02 + gear_E * 0x01);
for (i = 0; spindle_speed_in > speeds && i < 14; i++);
gear_required = reqd_gear;
if (gear_required == actual && gear_required != 0x0){ // We are in the right gear
spindle_enable_out = spindle_enable_in;
motor_speed_out = speeds[13] * (spindle_speed_in / speeds);
message = 0;
} else {
int j;
motor_speed_out = 0;
spindle_enable_out = 0;
for (j = 0; j < 13; j++) { message(j) = 0; }
message(i) = 1;
}
}

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 13:59 #116861 by andypugh
Does it compile now?

I think that it might choose one gear too high. Might need to be i-1 after the for loop.

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 14:00 #116862 by tecno

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 14:02 #116863 by andypugh
please try to compile the version I attached to the message after that error report

Please Log in or Create an account to join the conversation.

More
30 Aug 2018 14:07 #116864 by tecno
This give more errors that have been fixed so the lastone i did gives less errors.

bengt@debian:~/linuxcnc/backup$ sudo halcompile --compile GB_2speed.comp
[sudo] password for bengt:
make KBUILD_EXTRA_SYMBOLS=/usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-3.4-9-rtai-686-pae SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Entering directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
CC [M] /tmp/tmpY2LaFR/GB_2speed.o
GB_2speed.comp: In function ‘_’:
GB_2speed.comp:32:12: error: ‘high_gear’ undeclared (first use in this function)
GB_2speed.comp:32:12: note: each undeclared identifier is reported only once for each function it appears in
GB_2speed.comp:32:31: error: ‘motor’ undeclared (first use in this function)
GB_2speed.comp:32:37: error: ‘high’ undeclared (first use in this function)
GB_2speed.comp:38:3: error: ‘message’ undeclared (first use in this function)
GB_2speed.comp:25:14: warning: unused variable ‘reqd’ [-Wunused-variable]
make[4]: *** [/tmp/tmpY2LaFR/GB_2speed.o] Fel 1
make[3]: *** [_module_/tmp/tmpY2LaFR] Fel 2
make[2]: *** [sub-make] Fel 2
make[1]: *** [all] Fel 2
make[1]: Leaving directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
make: *** [modules] Fel 2
bengt@debian:~/linuxcnc/backup$

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.233 seconds
Powered by Kunena Forum