Action
Returns a byte stored in code memory.
Syntax
var = CPEEK( address )
Remarks
var |
Numeric variable that is assigned with the content of the program memory at address |
address |
Numeric variable or constant with the address location |
There is no CPOKE statement because you cannot write into program memory.
See also
Example
'-----------------------------------------------------
' (c) 1995-2006 MCS Electronics
' PEEK.BAS
' demonstrates PEEk, POKE, CPEEK, INP and OUT
'
'-----------------------------------------------------
Dim I As Integer , B1 As Byte
'dump internal memory
For I = 0 To 127 'for a 8052 225 could be used
' Break
B1 = Peek(i) 'get byte from internal memory
Printhex B1 ; " ";
'Poke I , 1 'write a value into memory
Next
Print 'new line
'be careful when writing into internal memory !!
'now dump a part ofthe code-memory(program)
For I = 0 To 255
B1 = Cpeek(i) 'get byte from internal memory
Printhex B1 ; " ";
Next
'note that you can not write into codememory!!
Out &H8000 , 1 'write 1 into XRAM at address 8000
B1 = INP(&H8000) 'return value from XRAM
Print B1
End