Can I use a C shell script for my PLC stuff?

More
30 Jan 2012 08:48 #17277 by andypugh
Per-instance variables declared above the ;; need the "variable" keyword.
You can declare variables in the usual way after the ;; but they will be shared between all instances. (probably not a problem here)

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

More
02 Feb 2012 03:22 #17331 by JR1050
I tried running comp on the code listed above and got the following feedback.Anybody know what it means????

root@jr1050-desktop:/usr/realtime-2.6.32-122-rtai/modules/emc2# comp --install buttonlogic.comp
Traceback (most recent call last):
File "/usr/bin/comp", line 1321, in <module>
main()
File "/usr/bin/comp", line 1290, in main
process(f, mode, outfile)
File "/usr/bin/comp", line 1164, in process
a, b = parse(filename)
File "/usr/bin/comp", line 404, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack


they seem to be Python errors,comp appears to be written in python.....

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

More
02 Feb 2012 06:52 #17333 by andypugh
JR1050 wrote:

File "/usr/bin/comp", line 1321, in <module>
main()
they seem to be Python errors,comp appears to be written in python.....


Yes, comp is a Python program which preprocesses .comp files into C files, and then compiles them.
It is sometimes helpful to do only the preprocessing step and to look at the resulting C code to see what has gone wrong.

However, if your problem is with the code listed earlier, then I have already explained that it is not a valid .comp, so you need to at least fix those problems first.

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

More
02 Feb 2012 14:48 #17341 by JR1050
Thank you for the quick response.I fixed the variable syntax and a few other snafu's(that were brought to my attention by the comp program.At one point I even cut the file down to the first function.This is my first go at full blown c progamming(Im used to fanuc macro and Delta Tau plc,which is like Basic and C combined).So for the dumb question,how do I run the pre processer?I didnt see any reference to it in the comp section of the manual.....Thanks again

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

More
02 Feb 2012 14:52 #17342 by andypugh
JR1050 wrote:

how do I run the pre processer?


The according to:
www.linuxcnc.org/docview/html/hal_comp.h...-realtime-components
if you run comp without any of the flags, that is what it does, it creates a c file from the comp file, and leaves it in the current directory.

Normally you comp --install, but that deletes the intermediate C-code after it has compiled it.

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

More
02 Feb 2012 15:53 #17343 by BigJohnT
JR1050 wrote:

So for the dumb question,how do I run the pre processer?I didnt see any reference to it in the comp section of the manual.....Thanks again


Plenty of examples of how to run comp in the manual...

linuxcnc.org/docview/2.5/html/hal/comp.h...s_in_the_source_tree

John

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

More
02 Feb 2012 16:22 #17344 by JR1050
The manual could use some fine tuning,it assumes you know the how the Comp program works and it is missing some key points of info like"to check for errors and preprocess your code,do this"!! I understand Emc is a work in progress and I do appreciate all the work the community puts in.After I figure this thing out,I would like to add to the missing info,you guys want some help?

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

More
02 Feb 2012 16:25 #17345 by BigJohnT
We always want help :) just ping me when your ready to make improvement to the documents.

John

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

More
03 Feb 2012 03:38 #17354 by JR1050
Ok,Im at odds with this comp thing.I ran my code thru the preproceser and got the same same Value error as i posted before.I made a new file with the" constant" example from the manual and got this ;

oot@jr1050-desktop:/usr/realtime-2.6.32-122-rtai/modules/emc2# comp constant.comp
Traceback (most recent call last):
File "/usr/bin/comp", line 1321, in <module>
main()
File "/usr/bin/comp", line 1290, in main
process(f, mode, outfile)
File "/usr/bin/comp", line 1164, in process
a, b = parse(filename)
File "/usr/bin/comp", line 404, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack

The same thing.The only file I could get to rum thru comp is an example file for an orac tool changer.What simple thing am i missing?What is this value error thing and what is the meaning of line 404 and its associated code.This shouldnt be this hard....

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

More
03 Feb 2012 04:33 #17355 by JR1050
GOT iT. I was trying to run this from the usr/bin ect directory.When I put it in the home folder with the other machine specific fiies and ran "sudo comp buttonlogic.comp",it ran.
DUHHHH

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

Time to create page: 0.281 seconds
Powered by Kunena Forum