This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Explanation of code

Hi can someone please help with the explanation of this code below, more importantly how does the uC 'see' the Sqrs: line at the end of the code

I am interested in something similar in a project i am currently doing whereby the input data of a PORT is compared to certain values and the the result stored in a register.

What function does PC have in the code?

org 0
ljmp Main

Main:

mov P3, #0xFF ; Port 3 is an input

loop: mov a, P3

anl a, #0x0F ; Clear bits 7..4 of A

lcall sqrt

mov P1, a

sjmp loop

sqrt: inc a

movc a, @a + PC

ret

Sqrs: db 0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3

0