Mikroelektronika MIKROE-724 データシート

ページ / 726
676
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
memmove
Prototype
sub procedure memmove(dim p1, p2, as ^byte, dim nn as word)
Description The function copies 
nn
 words from the memory area starting at the address 
p2
 to the memory area 
starting at 
p1
. If these memory buffers overlap, the 
Memmove
 function ensures that the words in 
p2
 are 
copied to 
p1
 before being overwritten.
For parameters 
p1
 and 
p2
 you can use either a numerical value (literal/variable/constant) indicating 
memory address or a dereferenced value of an object, for example 
@mystring
 or 
@PORTB
.
Example
txt = “mikroElektronika”
txt_sub = “mikr”
memmove(@txt+7, @txt_sub, 4)  ‘ string ‘txt’ will be populated with first 4 
characters of the ‘txt_sub’ string, beginning from the 7th character
memset
Prototype
sub procedure memset(dim p as ^byte, dim character as byte, dim n as word)
Description The function fills the first 
n
 words in the memory area starting at the address 
p
 with the value of word 
character
.
For parameter 
p
 you can use either a numerical value (literal/variable/constant) indicating memory 
address or a dereferenced value of an object, for example 
@mystring
 or 
@PORTB
.
Example
txt = “mikroElektronika”
memset(@txt, “a”, 2)  ‘ routine will copy the character ‘a’ into each of the 
first ‘n’ characters of the string ‘txt”,
strcat
Prototype
sub procedure strcat(dim byref s1, s2 as string)
Description The function appends the value of string 
s2
 to string 
s1
 and terminates 
s1
 with a null character.
Example
txt = “mikroElektronika”
txt_sub = “mikr”
txt[3] = 0
strcat(txt, “_test”)  ‘ routine will append the ‘_test’ at the place of the 
first null character, adding terminating null character to the result