??? 03/29/10 14:31 Read: times |
#174589 - Look at string manipulation on other targets - almost same Responding to: ???'s previous message |
Besides producing a bit uglier instruction sequences becaus of some limitations in the 8051 core, there isn't much difference from working with strings on other target hardware. The 8051 can't handle huge strings, but the C library is still the C library - same string functions as available with other C compilers. And besides being able to specify which memory area to use for data, a character pointer on the 8051 is quite similar to a char pointer on another target, i.e. this works:
p = buf_to_send; while (*p) { wait_until_uart_transmit_ready(); SBUF = *p++; } The additional extra for you is if you want to force your buffers to be in a specific memory region by explicit data type declarations, or by selecting memory model (which might activate Erik about inefficiencies of the large model...) The best is of course not not have any busy loops in the code, but to instead use interrupt-driven communication. Have you taken a look at the sample code available on this site? |