MemCmp()

MemCmp() compares to areas in memory (SRAM). Syntax: result = MemCmp( s1Adr as word, s2Adr as word, numBytes as word )

  • s1Adr/s2Adr: Start addresses of the two memory areas (SRAM).
  • numBytes: Number of bytes to compare.
  • result: Integer-value of the result, meaning:
    • = 0: s1 = s2
    • > 0: s1 > s2
    • < 0: s1 < s2

Example

const F_CPU  = 20000000
avr.device	= atmega328p
avr.clock		= F_CPU
avr.stack		= 32
uart.baud		= 19200
uart.send.enable
uart.recv.enable
print 12;"MemCmp() example"
dim i,a as byte
dim m as memoryblock
m.New(60)
m.CString(0)="Hello"
m.CString(20)="Hello"
print "MemCmp(): ";str(memCmp(m.Ptr+0,m.Ptr+20,5))  'output: 0 (gleich)
print
print "ready"
do
loop