User manual
204
mikoBasic PRO for PIC32
MikroElektronika
Be careful when handling strings in this way, since overwriting the end of a string will cause an unpredictable
behavior.
Array of string is declared in this manner:
typedef str as string[5] ‘ rst, declare str as a string of 5 elements
dim buffer as str[5] ‘ now, declare buffer as a array of str elements
String Concatenating
mikroBasic PRO for PIC32 allows you to concatenate strings by means of plus operator. This kind of concatenation is
applicable to string variables/literals, character variables/literals. For control characters, use the non-quoted hash sign
and a numeral (e.g. #13 for CR).
Here is an example:
dim msg as string[20]
res_txt as string[5]
res, channel as word
main:
‘...
‘ Get result of ADC
res = Adc_Read(channel)
‘ Create string out of numeric result
WordToStr(res, res_txt)
‘ Prepare message for output
msg = “Result is “ + ‘ Text “Result is”
res_txt ‘ Result of ADC
‘...
Notes:
- In current version plus operator for concatenating strings will accept at most two operands.
- mikroBasic PRO for PIC32 includes a String Library which automatizes string related tasks.