String handling functions | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
String handling functions
September 1, 2015
8:31 am
Avatar
BernardK
UK
Member
Forum Posts: 5
Member Since:
August 29, 2015
sp_UserOfflineSmall Offline

I have a couple of problems regarding string handling:

1) Byte Array to String - The byte sequence I am converting is 36,77,60,0,100,100,13. The converted sequence is 36,77,60,0,0,0,0.

2) A string constant of '$M<' appears to the compiled program as '$M'. i.e. the < character seems to be dropped.

Help appreciated.

Target - Atmega2560. Compiler - V1.0.0.18. LabView - V2014

September 1, 2015
2:33 pm
Avatar
Steffan
Admin
Forum Posts: 305
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Can you post your VI that shows this behavior for #1?  We are looking into #2.  That may be a defect.

September 1, 2015
2:33 pm
Avatar
filipealtoe
Admin
Forum Posts: 89
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Can you post the VI you are trying to compile? It will be easier for me to understand what may be happening if I compile it on my end.

Thanks

Filipe

Cheers Filipe
September 1, 2015
3:20 pm
Avatar
BernardK
UK
Member
Forum Posts: 5
Member Since:
August 29, 2015
sp_UserOfflineSmall Offline

This is the simplest version of the vi. The input byte array is 36,77,60,0,100,100,13. The output byte array is 36,77,60,0,0,0,0.

BAtS-Error.pngImage Enlarger

Attachments

Target - Atmega2560. Compiler - V1.0.0.18. LabView - V2014

September 1, 2015
5:49 pm
Avatar
Steffan
Admin
Forum Posts: 305
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

For #1, this is a good catch that we don't have well documented.  But since LabVIEW uses the length value and not a terminating character to determine the end of the string, you can embed all characters that include the NULL character, or ASCII character 0, in the string in the LabVIEW environment.  However, since the code is ultimately converted to C++, the NULL character is interpreted as a termination character in the String, as this is how the String class is handled in C++.  As documented here, when passing LabVIEW strings to external code that expects a C string, the embedded NULL characters cause the code to interpret the string as terminating at the first NULL character.  This is the same way the String will be interpreted by the Arduino Compatible Compiler for LabVIEW.  We will add some documentation to the Byte Array to String function to help clarify this.  Hopefully you can workaround this by removing the NULL characters in your arrays before converting to Strings.

 

For #2 I have created Case 119.  In fact, any characters after a '&lt;' in a String constant will be dropped.  This will hopefully get resolved in the next release.  For the interim, here is a workaround.  Use a byte array to represent the '&lt;' character instead and concat the strings:

workaround.pngImage Enlarger

 

Please let me know if this answers your questions.

Attachments
September 1, 2015
7:10 pm
Avatar
BernardK
UK
Member
Forum Posts: 5
Member Since:
August 29, 2015
sp_UserOfflineSmall Offline

OK, understand that now. I have implemented a solution based on byte array handling rather than string handling.

It might be an idea to add a generic section on the differences between LabView strings and C strings rather than confine it to the Byte Array to String function alone.

I am in the process of developing some software for an arduino based IMU & flight controller. It is called the Multiwii Pro and has accels, servo drives, gyros and pressure on board. Of course there is readily available software for it but it is more fun to develop from scratch. The idea of LabView for micros appeals to me too, and this is an ideal test bench.

I hope you don't mind but as I go through this I will probably have a few more questions for you!

Target - Atmega2560. Compiler - V1.0.0.18. LabView - V2014

September 22, 2015
3:52 am
Avatar
Steffan
Admin
Forum Posts: 305
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

FYI, version 1.0.0.19 has been released which resolves Case 119 above and should be available for download on the LabVIEW Tools Network and VI Package Manager in the next few days.  See here for complete release notes.

Forum Timezone: UTC 0

Most Users Ever Online: 33

Currently Online:
1 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18

RTSLVU: 15

Dan6077: 11

Member Stats:

Guest Posters: 0

Members: 80

Moderators: 0

Admins: 3

Forum Stats:

Groups: 1

Forums: 2

Topics: 58

Posts: 289

Newest Members: Travlissah, viktorIcera, HowardClouG, Dianecet, Produktnaodchudzaniex

Administrators: geadmin: 5, filipealtoe: 35, Steffan: 89