Closed patfrench closed 3 years ago
Did you try it already? Do you have any issues?
You are writing 6 registers but your string is 5 registers log, so it will be padded by spaces as stated in documentation. If you need it to be padded by zeros, you should use "SIMTRO698\0\0\0"
Hi,
I have no problem with
write_string(0x1402,"SIMTRO698",5)
my problem is that the terminal character must be 0 (NULL in ASCII) I want to write the terminal character in the 6th register I will try your solution.
why three \0 ?
"SIMTRO698\0\0\0"
Thank you for answering so quickly
Please, count number of characters first. SIMTRO698
is 9 characters but you are writing 5 registers, which mean 10 characters. As the documentation of write_string
states. Your string will be padded with spaces. So in your case, just use
write_string(0x1402,"SIMTRO698\0",5)
If you need to set also the 6th register, then you should define also its content, if spaces are not good for you, so this is the meaning of additional two \0
. So the alternative is write_string(0x1402,"SIMTRO698\0\0\0", 6)
.
oups i'm sorry :( my str is "SIMTROF698" 0x1402 => 'SI' 0x1403 => 'MT' 0x1404 => 'RO' 0x1405 => 'F6' 0x1406 => '98' 0x1407 => caracter terminator = NUL
So then write_string(0x1402,"SIMTROF698\0", 6)
should just work
Or if you need to fill entire the last register write_string(0x1402,"SIMTROF698\0\0", 6)
hi, perfect !!!! it's good
thank you for your support
Your welcome. Please, close the issue if it is solved.
Hi,
I try to place a null caracter terminator in
write_string(0x1402,"SIMTRO698\0",6)
is it possible ?
Thank you