Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello everyone
I'm trying to build PLC that can be programmed through using GUI made in C++
I had an idea that using the GUI i'll create a txt file will contain a parsing of the commands that the user wants that the plc will do
in such manner the user can use multiple commands set and also store them for future use

I hope you manage to understand what i'm trying to say

My problem is how to write a C program that will convert to txt file into commands that now i can transfer into the chip
what do i need to do or where can i read about those types of programs?

thank you for your help

Matan F
example
txt-->
1)inputX outputY DO func(W)
2)inputX2 outputY outputYi ... Func(W2)
3)etc...
.
.
.

code to convert txt to C embedded --> what do you think need to go here




ps. i had an idea to do it with xml instead of txt
if it helps
Posted
Updated 27-Jan-13 3:26am
v2
Comments
Andreas Gieriet 27-Jan-13 10:01am    
What exectly is your problem? Where are you stuck?
It's not clear if you don't know how to Cross Comile C code or how to burn the object code to the PLC or ...?
Or do you want to invent some own language that should translate into C, which you then feed into your corss compilation and burnig tool chain?
You need to clarify where you got stuck, otherwise you won't get any useful answer.
Cheers
Andi

1 solution

You need to write (or implement) a language parser, that will convert the user input into your target commands. Take a look at http://www.antlr.org/[^] for some information.
 
Share this answer
 
Comments
Andreas Gieriet 27-Jan-13 12:50pm    
For C/C++ environment, Lex and YACC or the equivalent open source versions Flex and Bison are more common. Using ANTLR for something other than Java is still a bit of a pain for non-Java runtimes.
Cheers
Andi
Richard MacCutchan 28-Jan-13 4:32am    
True, thanks for reminding me.
Andreas Gieriet 28-Jan-13 4:53am    
You are welcome!
Andi

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900