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

More
8 years 2 months ago - 8 years 2 months ago #116299 by Hakan
And move declarations of
Code:
inputs_sum gearengaged
to before the for loop, together with the other declarations.
Last edit: 8 years 2 months ago by Hakan.

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

More
8 years 2 months ago #116300 by tecno
Now it compiled, did move int i;
FUNCTION(_) {
int i;
Code:
bengt@debian:~/linuxcnc/configs/sim.gmoccapy$ halcompile --compile gearbox3.compmake 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/tmpWxGYMf/gearbox3.o Building modules, stage 2. MODPOST 1 modules CC /tmp/tmpWxGYMf/gearbox3.mod.o LD [M] /tmp/tmpWxGYMf/gearbox3.ko make[1]: Leaving directory `/usr/src/linux-headers-3.4-9-rtai-686-pae' bengt@debian:~/linuxcnc/configs/sim.gmoccapy$

File Attachment:

File Name: gearbox3_2...9-2.comp
File Size:2 KB

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

More
8 years 2 months ago #116301 by rodw
You guys have still got a type mismatch on this line
Code:
wantedgear = geartouse;
assigning an int to an s32 which is a long. Refer my earlier post.
I've never had a problem with this style in components.
Code:
int geartouse = -1;
IF its not compiling or its generating compiler warnings that a syntax error in your code

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

More
8 years 2 months ago #116302 by tecno
But it compiled as per last edits.

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

More
8 years 2 months ago #116304 by Hakan
Int and long is not a problem, there is automatic casting as needed.

And in this environment an int is 4 bytes = length of s32.

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

More
8 years 2 months ago #116305 by rodw
int is 16 bits
long is 32 bits (which is where the 32 comes from in S32)

I'm not really sure how halcompile modifies things with S32 data types. In most computer architectures, the low order 16 bits of a 32 bit variable are usually compatible with a 16 bit variable so its probably OK.

Over the years I've learnt to obsess over getting the typdefs 100% right and use implicit type declarations to convert between types without leaving it to chance as you can get bitten.

The other gotcha is assigning values to longs (hence the L modifier eg 0L) to make sure the compiler gets the full 32 bit value. I have been caught with code where the L is omitted hence my caution. Always treat compiler warnings as potential errors.

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

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