![]() ![]() now let´s separate the 1 + 4 + 3 = 8 fieldsįield1 = StringMid ( $sResult, 1, 1 ) this is just a characte rbetwen A-Zįield2 = ASC ( StringMid ( $sResult, 2, 1 ) ) LSB of the ADC value.So, it´s vital that 0 be not interpreted as end of string by receiver (PC) besides the first one, all other chars have byte values.$sResult = _CommAPI_ReceiveData($hFile) will have at $sResult a " string" with 12 " chars" **. ![]() Your message will arrive with 1 + 4 x 2 + 3 = 12 bytes (or as AU3 sees it, a " string" with 12 "chars"). Now supose the message has: 1 letter(A-Z) + 4 ADC values + 3 counters of anything (each one byte). To know about the UDF to read/write serial port, please refer to the above link, with focus at post #3 and overįirst, what is a binary stream? As an example, a microcontroler (PIC) getting data thru ADC and sending the 2 adquired bytes straight thru serial, without any treatment. It is about tips in receiving binary data thru a serial port, including value 0 (=end of string**). I hope it can help someone. ![]() I think these routines are great, as they are simple to use, and use windows API with NO DLL´s. This topic is a complement of therealhanuta´s >CommAPI - Serial and parallel communication with Windows API ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |