I'm hoping this is the right place to just post general questions as I'm trying to figure out how to program more complex things in Codesys.
First thing is I'm trying to figure out how to work with Functions using Pointers. I think I've got it mostly figured out but the part that doesn't make sense is how the function needs to return something. Is it possible to not return anything from a function call? Otherwise I'm going to make some sort of dummy variable.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey, that's an amazing project. I'd be very proud, if parts of our software
would make this beast move. Are you already using CODESYS in it, or is it a
new modification, on which you are working?
Regarding your question:
You always need to return s.th. in IEC. So usually you return a BOOL, if
you have nothing else to say. There is no such thing, like a void function.
It doesn't also feel natural in IEC, as the function represents more or
less its return value. When you return a resilt, you assign it to the name
of the function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. So it would seem it is not possible but Codesys seems happy enough with it to just be called without assigning to a variable as long as you're not assigning anything to the output in the function. Still need to define the type of output but no need to do anything more than that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is what I'm working on for those that might be interested. https://www.youtube.com/channel/UCepKsWePdtKjsud7cqjbB9A
I'm hoping this is the right place to just post general questions as I'm trying to figure out how to program more complex things in Codesys.
First thing is I'm trying to figure out how to work with Functions using Pointers. I think I've got it mostly figured out but the part that doesn't make sense is how the function needs to return something. Is it possible to not return anything from a function call? Otherwise I'm going to make some sort of dummy variable.
Hey, that's an amazing project. I'd be very proud, if parts of our software
would make this beast move. Are you already using CODESYS in it, or is it a
new modification, on which you are working?
Regarding your question:
You always need to return s.th. in IEC. So usually you return a BOOL, if
you have nothing else to say. There is no such thing, like a void function.
It doesn't also feel natural in IEC, as the function represents more or
less its return value. When you return a resilt, you assign it to the name
of the function.
You can delete the return type after insertion in the function's declaration section, no dramas.
Thanks. So it would seem it is not possible but Codesys seems happy enough with it to just be called without assigning to a variable as long as you're not assigning anything to the output in the function. Still need to define the type of output but no need to do anything more than that.