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

More
14 Aug 2018 10:19 #116028 by tecno
OK, I think it works.

1:st part with halcompile gearblokcer.comp no errors
2:nd part with halcompile --compile gearblocker.comp there is a list of errors See enclosed compile.txt

File Attachment:

File Name: compile.txt
File Size:2 KB

File Attachment:

File Name: gearblocker.c
File Size:8 KB


Is all OK or not?
Attachments:

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

More
14 Aug 2018 10:51 - 14 Aug 2018 10:52 #116030 by andypugh
No, there are typos and errors in the file.

Firstly, I have copy-and-paste errors, the cases should be 1, 2, 4, 8, 16, default

"case else" is wrong. it should be "default:" I have been coding too much Visual Basic recently, and that is the VB equivalent.

Also, I have got some of the internal names of the pins mixed up (should be gear_min_speed() )

I also spotted an off-by-one error in the gear numbering (the HAL pins always start at zero, so we need to number gears from zero)
Attachments:
Last edit: 14 Aug 2018 10:52 by andypugh.

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

More
14 Aug 2018 10:58 #116032 by rodw
Andy, a very nice piece of code. You are better than me! I refuse to do anything in Visual Basic! :woohoo:

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

More
14 Aug 2018 11:26 #116034 by tecno
Result of last edit

File Attachment:

File Name: compile2.txt
File Size:1 KB
Attachments:

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

More
14 Aug 2018 12:01 #116036 by rodw
Andy's left some typos so you can learn more about C coding :)
Change Line 47 to:
motor_speed_out = spindle_speed_in * gear_ratio(gear);

The error tells you exactly the problem
gearblocker.comp:47:23: error: ‘spindle_speed_’ undeclared (first use in this function)
spindle_speed_’ should be spindle_speed_in’

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

More
14 Aug 2018 12:10 - 14 Aug 2018 12:11 #116038 by tecno
bengt@debian:~/linuxcnc$ halcompile --compile gearblocker.comp
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/tmpnTwZlQ/gearblocker.o
gearblocker.comp: In function ‘_’:
gearblocker.comp:23:5: warning: unused variable ‘i’ [-Wunused-variable]
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/tmpnTwZlQ/gearblocker.mod.o
LD [M] /tmp/tmpnTwZlQ/gearblocker.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.4-9-rtai-686-pae'
bengt@debian:~/linuxcnc$

I got a .ko file now so I assume all is OK even with above warning?
Last edit: 14 Aug 2018 12:11 by tecno.

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

More
14 Aug 2018 12:21 #116040 by tecno
FUNCTION(_){
int i; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< delete this line ?

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

More
14 Aug 2018 12:47 #116043 by tecno
No warning after deleting that line.

Now to fiddle with HAL

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

More
14 Aug 2018 13:07 #116044 by tecno
I have added following lines to HAL
# gearbox input signals
# gearbox Hi/Lo
net gearblocker.0.high-gear  <=  hm2_7i76e.0.7i76.0.0.input-15

# gearbox A - B - C - D - E
net gearblocker.0.gear-A  <=  hm2_7i76e.0.7i76.0.0.input-10
net gearblocker.0.gear-B  <=  hm2_7i76e.0.7i76.0.0.input-11
net gearblocker.0.gear-C  <=  hm2_7i76e.0.7i76.0.0.input-12
net gearblocker.0.gear-D  <=  hm2_7i76e.0.7i76.0.0.input-13
net gearblocker.0.gear-E  <=  hm2_7i76e.0.7i76.0.0.input-14
loadrt gearblocker
addf gearblocker.0 servo-thread

So how to do with following lines in COMP
component gearblocker;

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 float gear.#.min-speed[10];
pin in float gear.#.max-speed[10];
pin in float gear.#.ratio[10];

File Attachment:

File Name: cb_gearbox...8-14.hal
File Size:17 KB
Attachments:

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

More
14 Aug 2018 13:22 #116045 by rodw

FUNCTION(_){
int i; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< delete this line ?


Yeh, you've done the right thing. It was just C politely telling you there was a variable that had not been used.
Warnings are basically telling you there is a problem that might be a problem but its not a fatal error so it will compile OK. Its best to eliminate them though as sometimes they can bite you.

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

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