CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Sep 22, 2019 10:21 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: system command result
PostPosted: Wed Oct 29, 2014 12:53 pm 
Offline

Joined: Thu Sep 18, 2014 12:10 am
Posts: 88
Please explain us how we can take return result in Plc application of system commands like:
"cat /proc/cpuinfo "?

Regards


Top
   
PostPosted: Wed Oct 29, 2014 8:10 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3454
Hi,

use this project from this link, and feel free to modify it to your needs:
viewtopic.php?f=21&t=5923#p11084

change szFilename: STRING := '/proc/cpuinfo';

and somehow you need to get your information from the buffer which contains then /proc/cpuinfo ... see screenshot
BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Mon Nov 03, 2014 12:11 am 
Offline

Joined: Thu Sep 18, 2014 12:10 am
Posts: 88
I try your solution but it gives a result string of 278 characters only, not include the serial number.
Is there any solution to call from codesys runtime a shell command and take the result?

Regards.


Top
   
PostPosted: Mon Nov 03, 2014 5:50 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3454
Hi,

you need to specify your startpos to read see screenshot.
BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Mon Nov 03, 2014 6:40 am 
Offline

Joined: Thu Sep 18, 2014 12:10 am
Posts: 88
Is there any other way to run OS command and take back the result?
Because if I use your solution I can't run commands like in shell mode.

Regards


Top
   
PostPosted: Mon Nov 03, 2014 7:50 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3454
Hi,

you can call every shell command but you do not get the result/output of them back to the iec world.
that's the point, so you need in this case to use the char device example.

Regards
Edwin


Top
   
PostPosted: Mon Nov 03, 2014 9:04 am 
Offline

Joined: Thu Sep 18, 2014 12:10 am
Posts: 88
How can I use the command "grep -i serial /proc/cpuinfo | cut -d" " -f2" with chardevice and take the result?

Regards


Top
   
PostPosted: Mon Nov 03, 2014 9:15 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3454
that's what I already said:
It is not possible to get the result to the iec world...but you have a workaround!
BR
Edwin


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: Tiziano and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited