How do you compile individual bytes into a string so you can use STRCOMP?
Microcontrolled
Posts: 2,461
The title says it all. I have to compare bytes that are collected from keyboard presses and compile them into strings so that they can be compared to other words using STRCOMP. All help is appreciated.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.
Robots are microcontrolled.
I am microcontrolled.
But you·can·call me micro.
Want to·experiment with the SX or just put together a cool project?
SX Spinning light display·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.
Robots are microcontrolled.
I am microcontrolled.
But you·can·call me micro.
Want to·experiment with the SX or just put together a cool project?
SX Spinning light display·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5
Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.
Robots are microcontrolled.
I am microcontrolled.
But you·can·call me micro.
Want to·experiment with the SX or just put together a cool project?
SX Spinning light display·
5000 keystrokes is a _lot_ to buffer but I guess you have a reason for having so many.
A byte (8 bits) can hold a value between 0 and 255 (256). The ASCII "character set" [noparse][[/noparse]string] is defined as the "printable" characters represented as values between 32(10) and 127(10) - generally <SPACE> through the numeric values and the UPPER and lower case characters of the English alphabet; including typical symbols and sometimes 'graphic' characters. Values between 0 and 31, and beyond 127 but less than 256 are generally used as control or 'special graphic' characters and may or may not be "printable" - on any given [noparse][[/noparse]Human readable] display unit.
Commonly, the NULL (0) value is defined as a 'terminator' for byte [noparse][[/noparse]string] sequences of consecutive register locations containing values between 32(10) and 127(10) - mostly because a "zero" character does not have a "visible" representation on a Human readable display. Humans determined what is displayable, a control character or perhaps a "special" graphic character. To a computer, a byte holds a value between 0 and 255 (unsigned). Zero; the "ASCII" number of 48 (10) is not to be confused with "NULL" 0 (0).
Determinations such as this are "defined" in libraries, compilers or ROM as appropriate according to "standards".
Routines like STRCOMP, strcmp(3) and similar can generally use any value between 1 and 255 (unsigned char) as a valid comparison value and _expect_ a NULL to be at some sensible count value between the beginning (zero) and end value of the "string" length. Most do not check length.
It would be (sensibly) rare to see an end value exceed 255 + 1 (which includes a NULL byte); but a Programmer can do as they see fit if they are not using any "standard" and do not expect or desire any portability or cross-platform interoperability.
I have a function that takes indiviual bytes and builds a string for you out of them. I also have triming functions an tokenization functions for word processing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.
Robots are microcontrolled.
I am microcontrolled.
But you·can·call me micro.
Want to·experiment with the SX or just put together a cool project?
SX Spinning light display·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.
Robots are microcontrolled.
I am microcontrolled.
But you·can·call me micro.
Want to·experiment with the SX or just put together a cool project?
SX Spinning light display·
Generally, relying on 5000 bytes of input to be correct without some kind of an integrity check is trouble. As an example, Internet Protocol packets have a maximum transfer unit size for segmentation/reassembly of large packets. Each resulting packet carries a 32 bit "CRC" for integrity checks. An mp3 file will be segmented into packets for transmission by the sender; the receiver will reassemble the packets into your mp3 file. The underlying TCP protocol will ensure that all good packets are delivered to the application. Your job for 5000 bytes on a serial stream is similar to this one way or another [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,