Using Strings on NB HMI with Sysmac NX/NJ

Updated April 18, 2023

Introduction

When using STRING Data Type on Sysmac NJ with HB HMI, please note the following restrictions:- 

The NB ‘Text Display’ and ‘Text Input’ ‘parts’ enable a user to display and enter STRINGs. However, the NB HMI will always pad any remaining characters with the space character (ASCII - 0x20, or 32 Decimal). 

The Sysmac NX/NJ terminates its strings with a NULL (ASCII 0x00) character. This is the ‘c’ standard of termination for STRINGs. The length of an NB String can only be defined as a number of words in length – meaning that the length of the data will always be an even number of characters. 

If the Sysmac NX/NJ is made to exactly the same number of characters as the NB, then it will fail to read correctly in the NJ. This is because there will be a runtime fault due to there being no NULL terminator. Sysmac NX/NJ must see a NULL to know where the STRING is terminated. Therefore always define the STRING in the Sysmac NX/NJ one byte longer than defined in the NB. 

Solution

When using STRINGs/Text with NX/NJ and NB, always make the NX/NJ STRING at least one character longer than the NB definition.

Example

For example In NB – a Text Input is defined as 5 words (10 characters in length).

In the NX/NJ, define the length of the STRING one character longer than in NB.

NbHmiString is defined AT D0 (%D0) and length 11 characters. So code that works with the STRING entered on the NB HMI will always be terminated correctly (assuming that no other data butts up to the end of the data in %D0).



Start a Conversation
This conversation is closed
Uploading...