Sign in to follow this  
Followers 0
BITS N BYTES

ASCII Lower/Uppercase Conversion

5 posts in this topic

Using CJIM-CPU21 for RS232 serial communications from a host device. I have defined the message format and protocol but the host device cannot [more like integrator will not] guarantee that message strings will be in the same case [uppercase/lowercase]. In some instances the case could even be mixed in the same message string. Does anyone have a neat idea to convert all characters in the RECEIVED message string to uppercase format??

Share this post


Link to post
Share on other sites
The only thing that I can think of would be to examine the ASCII value of each digit, (lower case a - z = 61 to 7A, upper case A - Z = 41 to 5A), then if the incoming value is between 61 and 7A, subtract 20 (hex). That's about it from me!

Share this post


Link to post
Share on other sites
Thnx anonymous, that looks like a very simple solution I would not have thought of. I guess I have been working with BITS N BYTES too long. Need to improve my WORDS N MESSAGES skills.

Share this post


Link to post
Share on other sites
Put this in a loop by using FOR and NEXT and increment the character counter before returning to the top of the loop.

Share this post


Link to post
Share on other sites
You obviously were tyring to BYTE off more then you could chew..... Rembember, to solve complicated problems it helps to break them down into smaller portions...Therefore only a NIBBLE at a time is required and pretty soon you would have finshed a whole meal....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0