Technical FAQs

Ask a Question

How can I receive Data from Hyper Terminal to a Magelis HMI using Script Driver?

Here is a sample script to receive Data from Hyper Terminal to a Magelis HMI using Script Driver:

// 1. Create script variables

// For reading messages from hyperterminal

int result;

byte readArray[]= new byte[20];

 

// 2. Read data from serial port

result = HyperTerminal.read(0, 20, readArray);

if (result <= 0)              // Check for error

ReadText.write("ERROR"); // Write to variable

else

{

// Convert byte array to String

String temp = new String( readArray );

ReadText.write(temp);

}

Was this helpful?
What can we do to improve the information ?