Hi Benj, hi Jac
Many Thanks for your Time and Help!!!
Best thank to you!
I am honest - my favorite language is Assembler, Pascal / Lazarus / Delphi
and with ( $ is a Info for compiler that comes a Integer as Hex ( likewise))
Code: Select all
VAR MyString : String;
begin
MyString := char($7E) + char($00) + char($17);
SerialCom.write(MyString,Length(MyString);
end
i am very spoiled ( i hope this is the correct translating for "verwöhnt" )
I have test in Code::Block the same and this cut the
string too, so i wounder me
Code: Select all
MyString[0] = 0x7E;
MyString[1] = 0x00;
MyString[2] = 0x17;
printf(" %s", MyString);
Let me see only "~" at the console
ok - i have understand yesterday so:
I allways make this:
Code: Select all
MyString[0] = 0x7E;
MyString[1] = 0x00;
MyString[2] = 0x17;
RS232.SendString (MyString);
This cuts the Stríng.
So i change one Time yesterday to:
Code: Select all
MyString[0] = 0x7E;
MyString[1] = 0x00;
MyString[2] = 0x17;
RS232.SendChar(MyString[0]);
RS232.SendChar(MyString[1]);
RS232.SendChar(MyString[2]);
Will do my work and sends the 0x00 well
a "
string" with 50 char ... is many write work..
and so if the "
string" is very long i use a while with .i variable for length of the
string ( and this was the wrong thinking from me, because the lengt is cut too with 0x00 in a
string )
"pseudo.. likewise"
Code: Select all
MyString[0] = 0x7E;
MyString[1] = 0x00;
MyString[2] = 0x17;
int i = 0;
while (i < Length$(MyString) )
{
RS232.SendChar(MyString[i]);
i++;
}
and wounder me because only one "character" was send
( 0x00 cuts the length% function too
)
ok, i think i have understand yours now..let me try
..
my thinking wrong is,, all what is "
string" theme - it will cut ( null terminated ) if 0x00 in it
length$..
printf("%s",MyString);
ok i think i have understand - this the same like in MIDI Theme with sending "char" as Hex..
The first ( from me ) think .. was wrong
pseudo .. ( forget this code block this was a wrong thinking from me... but i will write down here.. )..
Code: Select all
INT MyData[30] ) ; // generate a INT Array of Bytes with 30 fields.. ( i will look next time how i can set all fields to empty values ( initialize ) ) in one way.. in C )
MyData[0] = 0x7E;
MyData[1] = 0x00;
MyData[2] = 0x17;
..
..
// Is there a Function in Flowcode to check how many fields are used? i_used = idx 0 .XX. 1.XX. 2.XX. 3.XX. 4.// 5.//
// 4 Fields are used - so a while can run 4 times for sending..
int i_used ....
while (i < i_used )
{
RS232.SendChar(MyString[i_used]);
i_used++;
}
forget the code block...
i think this is the right you are mean
...
Pseudo mix
Code: Select all
char MyDatagram[] = {0x7E, 0x00, 0x65, 0x00, 0x16, 0x28, 0x10, 0x66};
size_t MyDatagramSize = sizeof(MyDatagram);
for (int i=0; i<MyDatagramSize; i++)
{
RS232.sendchar(MyDatagram[i]);
}
Ok ?
.. i hope.. because i allways learn from simple the Best
Thank you Benj, Jac and LeighM for allways right / properly food for thought!!!
Best wishes!!!
Rudi