Summary
Compares two blocks of data at the specified positions (offset), and writes the comparison result to the storage address.
The following values are stored as the comparison result: When the values are equal: When the target data is larger than the original data: When the target data is smaller than the original data: When an error occurs, the error status value is written to LS9152.
Format
_memcmp ([Compared block Address], [Compare To Block Address], [Comparison Result Storage Address], Offset from Start of Block, Number of Compared Words, Words in 1 Block)

Parameter 1: Internal Device
Parameter 2: Internal Device
Parameter 3: Internal Device
Parameter 4: Numeric Value (0 to 639), Internal Device, Temporary variable
Parameter 5: Numeric Value (1 to 640)
Parameter 6: Numeric Value (1 to 640)
Stored Data
0: Compare
1: Compare < Compare to
2: Compare > Compare to
Example expression 1:
_memcmp ([w:[#INTERNAL]LS1000], [w:[#INTERNAL]LS1005], [w:[#INTERNAL]LS0100], 0, 1, 5)
Compare one word from Block 1 and Block 2 (starting from offset 0) and save the comparison result in LS0100

Since the source value is smaller than the target value, the comparison result "1" is stored in LS0100.
![]()
Example expression 2:
_memcmp ([w:[#INTERNAL]LS1000], [w:[#INTERNAL]LS1010], [w:[#INTERNAL]LS0100], 2, 3, 5)
Compare one word from Block 1 and Block 3 (starting from offset 2) and save the comparison result in LS0100

Since the values of the original and target data match, the comparison result "0" is stored in LS0100.
![]()
Error Status

|
Editor Function Name |
LS Area |
Error Status |
Cause |
|---|---|---|---|
|
_memcmp ( ) |
LS9152 |
0000h |
Completed Successfully |
|
0001h |
Parameter error |
||
|
0003h |
Write/Read error |
![]()
The effective LS address range that can be specified is limited to the designated user area (LS20 to LS2031 and LS2096 to LS8191).
When you specify a value that is larger than the number of words in one block to the offset of a block, this feature does not work.
When the number of words to compare is larger than one block, this feature does not work.