Specifications

Chapter 6 - Samples
How one such sequence is formed by using dt instruction is shown in the following example:
org 0x00
goto Main
String movwf PCL
String1 dt "this is 'ASCII' string"
String2 dt "Second string"
End
Main
movlw .5
call String
:
First instruction after label Main writes the position of a member of the string in w register. We
jump with instruction call onto label string where position of a member of the string is added to
the value of the program counter: PCL=PCL+W. Next we will have in the program counter an
address of retlw instruction with the desired member of the string. When this instruction is
executed, member of the string will be in w register, and address of the instruction that executed
after the call instruction will be in the program counter. End label is an elegant way to mark the
address at which the string ends.
Macro PRINT has five arguments:
PRINT macro Addr, Start, End, Var, Out
Addr is an address where one or more strings (which follow one by one) begin.
Start is an address of the first member of the string
End is an address where the string ends
Var is the variable which has a role of showing (pointing ) the members of the string
Out is an argument we use to send the address of existing subprograms assigned to output
devices such as : LCD, RS-232, etc.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/6_02Poglavlje.htm (3 of 4) [4/2/2003 16:18:43]