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

More
8 years 2 months ago #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

Attachment not found

Attachment not found



Is all OK or not?

Please Log in to join the conversation.

More
8 years 2 months ago #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)

Please Log in to join the conversation.

More
8 years 2 months ago #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 to join the conversation.

More
8 years 2 months ago #116034 by tecno
Result of last edit

Attachment not found

Please Log in to join the conversation.

More
8 years 2 months ago #116036 by rodw
Andy's left some typos so you can learn more about C coding :)
Change Line 47 to:
Code:
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 to join the conversation.

More
8 years 2 months ago #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?

Please Log in to join the conversation.

More
8 years 2 months ago #116040 by tecno
FUNCTION(_){
int i; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< delete this line ?

Please Log in to join the conversation.

More
8 years 2 months ago #116043 by tecno
No warning after deleting that line.

Now to fiddle with HAL

Please Log in to join the conversation.

More
8 years 2 months ago #116044 by tecno
I have added following lines to HAL
Code:
# 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
Code:
loadrt gearblocker addf gearblocker.0 servo-thread

So how to do with following lines in COMP
Code:
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];

Attachment not found

Please Log in to join the conversation.

More
8 years 2 months ago #116045 by rodw

tecno wrote: 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 to join the conversation.

Time to create page: 0.145 seconds
Powered by Kunena Forum