cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

How to read, write and post csv file stored in sd-card plugged in CF01 slot?

jh123
Member

How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Hello Community,

our customer is testing with our Drive based ctrlX Core to control their punching gun. Currently they are trying with PLC engineering to read and write the operation log into a csv file, which will be stored on a plugged sd-card in CF01 slot. 

We found that there is PLC lib called CXA_FileAsync, is this the right lib to be used? 

If there is simple how-to example, it will be really helpful.

Thanks and best regards,

Hui

11 REPLIES 11
CodeShepherd
Community Moderator

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Please have also a look to this thread discussing file access out of the PLC. I will ask to add a example.

TheCodeCaptain
Community Moderator

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Hi jh123,

there is an example included in the library, see screenshot.

The correct path to the SD Card would be eg. "/media/mmcblk1p1/testfile.txt", you have to mount the card before in the Settings --> Storage,

The name can be found in the web frontend "Settings --> Storage" as well

The file in the example will be written to appdata/plc/run/linux-gcc-aarch64/data. See also this post.

You could read/write it from there eg. with Node-RED, see second screenshot:

Path: /var/snap/ctrlx-node-red/current/solutions/activeConfiguration/plc/run/linux-gcc-aarch64/data/testfile.txt

TheCodeCaptain_0-1656307930922.png

 

TheCodeCaptain_0-1657030434093.png

 

 

jh123
Member

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Thanks a lot!

An example will be really useful. 

YT123
New Poster

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Hello, What if the file is stored on a network pc?  How to read, write and post csv file stored in a network pc? Thanks.

TheCodeCaptain
Community Moderator

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Hi YT123,

we have not yet a native build in client to map network drives, this is on our roadmap.

As a workaround you could try Node-RED.

Regards

YT123
New Poster

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Thank you for your quick reply. We look forward to having this function soon. 😀

TheCodeCaptain
Community Moderator

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Hi,

attached you find a simple flow how to make a smb access with Node-RED.

I used the "node-red-contrib-smb" package.

But be careful, it seems the package is not very well programmed, any miss configuration leeds to an uncaught exception.

TheCodeCaptain_0-1656416519134.png

 

jh123
Member

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?

Hello  TheCodeCaptain,

thanks for the example!

Btw, is it possible to realize it using PLC engineering ? Cause customer will mainly work with PLC.

Thx.

 

TheCodeCaptain
Community Moderator

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?Hi

Hi,

not as far as I know, guess you would need to wait for our build in function.

Regards

jh123
Member

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?Hi

Hello TheCodeCaptain,

Do you have the palette of SMB node that I can install with? This is not a default node.

Thx.

TheCodeCaptain
Community Moderator

Re: How to read, write and post csv file stored in sd-card plugged in CF01 slot?Hi

Hello jh123,

you are right, this is a third party node and not distributed by us, we can also not support it.

You can download it in the palette manager, your engeneering pc and your ctrlX need internet access for that.

TheCodeCaptain_0-1656488076846.png

 

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist