![](http://content.invisioncic.com/r129856/set_resources_2/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
dhazelman
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Events
Blogs
Downloads
Articles
Media Demo
Posts posted by dhazelman
-
-
Trying to create C function to convert a String ASCII to upper case.
This is what I tried and it does not work:
static void PrefixToUpper(volatile char* Prefix, int PrefixLen)
{
// User code starts below this comment
for (int i = 0; Prefix[i] != '\0' ; i++)
{
if(Prefix[i] >= 'a' && Prefix[i] <= 'z')
{
Prefix[i] = Prefix[i] - 32;
}
}
// User code ends above this comment
}
// User code starts below this commentTested the code in C compiler and it runs correctly:
static void PrefixToUpper(volatile char* Prefix)
{
// User code starts below this comment
for (int i = 0; Prefix != '\0' ; i++)
{
if(Prefix >= 'a' && Prefix <= 'z')
{
Prefix = Prefix - 32;
}
}
// User code ends above this comment
}int main()
{
char str[] = "hmh00234";
printf("String input: %s\n", str);
PrefixToUpper(str);
printf("String output: %s\n", str);
}
-
I am also having problems with this software hanging on startup. The software hang on Loading Components...
I am running Windows 10, 64 bit.
I have attached the log files as a zip file.
UniLogic logs.zip
C Function to convert string to upper case
in UniLogic Software
Posted
The ladder logic was working with out the PrefixToUpper call, just would fail the table lookup if the user entered lower case prefix. The table has all the prefixes stored as upper case.