DATA PIC18CXXX Example

MPASM Assembler

DATA PIC18CXXX Example

Directives highlighted in this example for PIC18CXXX devices are:

  • data

Program Functional Description

This example shows the usefulnes of directive data in storing one or more words in program memory.

Commented Code Listing

list p=18c452 ;Select device.

#include <p18c452.inc> ;Include standard header file

;for the selected device.

ORG 0000 ;The following code will be

;programmed in reset address 0.

goto start ;Jump to an address labelled

;'start'.

start ;Write your main program here to

;display the string given in

;'Ch_stng'.

goto $

ORG 1000 ;Store the string starting from

;1000H. In PIC18Cxxx devices, the

;first character is in least

;significant byte.

Ch_stng data 'M','C','U' ;3 program memory locations

;will be filled with ASCII

;equivalent of 'M','C' and

;'U'.

Ch_stg1 data "MCU" ;2 program memory locations

;will be filled with two

;words (16-bit numbers),

;each representing ASCI

;equivalent of two

;characters. The last

;character will be taken as

;NULL in case odd number of

;characters are specified.

tb1_dta data 0xffff,0xaa55 ;Places ffff and aa55 in

;two consecutive

;program memory location.

end


Microchip Technology Inc.
Microchip's Web Site
Voice: (480) 792-7200
Fax: (480) 899-9210
Microchip's E-mail Address
PreviousNext