Is it possible to have the CR1000 "print" Chinese characters ? Thanks !
Wei,
I know nothing about Chinese characters, but I see that your post has gone unanswered.
The CR1000 can transmit binary data over a connection using the SerialOpen and SerialOutBlock commands.
So I would think that if you know the Hexadecimal equivalents of the characters, you could form a message and "print" it over the serial connection.
Sam,
Thanks for the reply !
But each Chinese character is encoded in two bytes :(
Can you give us an example of the hex characters to say perhaps "hello" in Chinese characters?
你好
60 4F for 你
7D 59 for 好
Thanks !
To the datalogger, strings are simply arrays of bytes that have a null terminating character. It knows nothing of multi-byte sequences but is perfectly willing and able to store them. The only caveats that I can think of are as follows:
- The CRBasic Len() function will return the length of the string in bytes and not in characters.
- You will need to match the code page used for the datalogger strings to that used by your PC running LoggerNet.
- The CRBasic editor may (or may not) have issues with accepting multi-byte sequences.
- The keyboard display will not know how to display multi-byte sequences.
Thanks !
What do you mean by "code page used for the datalogger strings" ? How to set it ?
Here is an example of printing the characters you provided. The four bytes could have been concatenated into a single LONG, but I thought this made more sense when treating the characters individually. Notice that the SerialOutBlock instruction is printing two bytes each time it is executed. Those two bytes will be the upper bytes of the LONG, hence the "padding" used with the 0's.
Const Port = ComRS232
Public Chars(2) As Long = {&h604F0000, &h7D590000}
'TwoChars as Long = &h604F7D59
Public I
BeginProg
Scan (5,Sec,0,0)
SerialOpen (Port,9600,3,0,100)
For I = 1 To ArrayLength (Chars())
SerialOutBlock (Port,Chars(I),2)
Next I
'SerialOutBlock (Port,TwoChars,4) 'alternative way
SerialClose (Port)
NextScan
EndProg