Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

CR1000 & Chinese characters


Wei Jan 18, 2011 05:08 AM

Is it possible to have the CR1000 "print" Chinese characters ? Thanks !


Sam Jan 20, 2011 05:06 PM

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.


Wei Jan 21, 2011 06:26 AM

Sam,

Thanks for the reply !

But each Chinese character is encoded in two bytes :(


IslandMan Jan 21, 2011 11:41 AM

Can you give us an example of the hex characters to say perhaps "hello" in Chinese characters?


Wei Jan 21, 2011 11:49 AM

你好

60 4F for 你
7D 59 for 好

Thanks !


jtrauntvein Jan 21, 2011 02:30 PM

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.


Wei Jan 21, 2011 02:42 PM

Thanks !

What do you mean by "code page used for the datalogger strings" ? How to set it ?


Sam Jan 21, 2011 02:48 PM

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

Log in or register to post/reply in the forum.