Jump to content
OMRON Forums

Any examples of strtod in script code


daves

Recommended Posts

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I see in V1.3 FIRMWARE UPDATES details of string functions on particular strtod looks useful to me. I cannot get it to work or find any examples... Any advice?

 

Have you seen the exmaple in the mathematical feature specification?

 

ftp://support.deltatau.com/DT-USA/Power%20PMAC%20Documentation/PDFs/Software%20Reference/Power%20PMAC%20Mathematical%20Feature%20Specification%202011-01.pdf

 

Check out the bottom of page 72.

Link to comment
Share on other sites

Thanks shansen, I did see those as I posted but didn't get around to editing/addig to the post. I could not get them to work. The download said strtod was illegal (I am definitely running latest released firmware/IDE)

 

Link to comment
Share on other sites

  • 2 months later...

Running September release I still cannot get any of the Character Buffer Functions or String Manipulation Functions to work in my PLCs:

 

open plc 1
strcpy(256, "123")
p4 = strtod(256, 0)
close

 

These are detailed in "Power PMAC Script Mathematical Feature Specification.pdf", "Power PMAC Command Summary 2011-08.pdf", and "Power PMAC V1-3 Firmware Additions.pdf".

 

I cannot get them to download, and the intellisense has no knowledge of them. What am I doing wrong?

 

Dave

Link to comment
Share on other sites

These string functions are truly functions, which means they have a return value, which must be "put" somewhere. Your first PLC program line:

 

strcpy(256,"123")

 

gives a syntax error. It is no more valid than

 

cosd(30)

 

as a program line. You need to make it something like:

 

p3=strcpy(256,"123")

 

Function names are not presently included in the Intellisense.

Link to comment
Share on other sites

Thank you Curt. This works perfectly now, and I'm hopeful it could be a possible error reporting/logging mechanism in my project.

 

I guess the 'necessary return variable' is a PLC language feature?

 

My background is more C-type languages where it is acceptable to have lines such as strcpy(str, "123"); where the 'real' work happens in the parameters and you are uninterested in the result. Even cos(30); is a valid (if pointless) line.

 

Thanks again for putting me on the right track, your help is appreciated.

 

Dave

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...