Jump to content

Converting BYTE into ASCII Character in C


Recommended Posts

Guest Guest_Rusty_K
Posted
Hello, I am reading several BYTES from a PLC which each represent one ASCII character. How do I convert this so that WinCC will display the actual ASCII character and not the numeric ASCII code. Any help would be greatly appreciated. Cheers Mates! R.K.
Posted
Hi, create IOField of type Output and assign your byte tag to its Output Value property. Set its Display property to "No". In Events->Output Value->Change put the code below: char* data; data=SysMalloc(1); sprintf(data,"%c",(char)value); SetTagChar("TagString",data); SysFree(data); "TagString" is a WinCC internal tag of type string. Create second IOField of type Output and assign "TagString" to its Output Value property. Set its Data Format property to "String" and Output Format to "*". Regards, jacekd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...