Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use DT directive in PIC 16F84A

Status
Not open for further replies.

NIKO BELLIC

Newbie level 6
Joined
Aug 1, 2011
Messages
14
Helped
6
Reputation
12
Reaction score
5
Trophy points
1,283
Location
Kansas City, MO
Activity points
1,389
Hi all...
I am a newbie to PIC micros. I've learnt basic tutorials through online which uses assembly code. Now, I just want to display a string on 16x2 LCD using PIC 16F84A. I've googled it for number of times and I found that there is a directive in PIC assembly code called "DT" which can be used to display a string on LCD. I could not understand how to use it, i mean syntax and initialization. Here is the example code which I found...
Code:
TAB       addwf     PCL,F            ; Move offset to PC lower

   DT        "PROGRAM TEST RS232 PORT ON CPU PIC16F877 RUN FREQ 
10MHz",0X0A,0X0D
 

Hi,

Rather than Google, you should consult the appropriate documentation:

MPASM™ Assembler, MPLINK™ Object Linker MPLIB™ Object Librarian User’s Guide

Reference MPASM Assembler Guide Above, pg. 67, 4.19 dt - DEFINE TABLE (PIC12/16 MCUs):
4.19.1 Syntax
[label] dt expr [, expr, ..., expr]

4.19.2 Description
dt - Define data Table.
Generates a series of RETLW instructions, one instruction for each expr. Each expr
must be an 8-bit value. Each character in a string is stored in its own RETLW instruction.

4.19.3 Usage
This directive is used in the following types of code: absolute or relocatable. For
information on types of code, see Section 1.6 “Assembler Operation”.
This directive is used when generating a table of data for the PIC12/16 device family.
If you are using a PIC18 device, it is recommended that you use the table read/write
(TBLRD/TBLWT) features. See the device data sheet for more information.

4.19.4 See Also
data db de dtm dw

4.19.5 Simple Example
dt "A Message", 0
dt FirstValue, SecondValue, EndOfValues

You might also benefit from these excellent tutorials:

**broken link removed**

A PIC16 Assemble Example Using "dt" directive:

**broken link removed**

Study the LCD_TST.ASM module, it should provide you a clear example of the assembler directive "dt" use.

BigDog
 
Hi all...
I am a newbie to PIC micros. I've learnt basic tutorials through online which uses assembly code. Now, I just want to display a string on 16x2 LCD using PIC 16F84A. I've googled it for number of times and I found that there is a directive in PIC assembly code called "DT" which can be used to display a string on LCD. I could not understand how to use it, i mean syntax and initialization. Here is the example code which I found...
Code:
TAB       addwf     PCL,F            ; Move offset to PC lower

   DT        "PROGRAM TEST RS232 PORT ON CPU PIC16F877 RUN FREQ 
10MHz",0X0A,0X0D

Use the following method.

Call this routine with the string count value in W.

andlw 0Fh
addwf pcl,same
dt "0123456789ABCDEF"

The character will be returned in W.

Write this to the LCD.

Increament the count value till you have reached 16 (string is limited to 16 here)

Call the routine again.

Cheers

Ravi
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top