DATA PIC16CXXX Example

MPASM Assembler

DATA PIC16CXXX Example

Directives highlighted in this example for PIC16CXXX 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=16f877 ;Select the device.

#include <p16f877.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.

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

;will be filled with ASCII

;equivalent of 'M','C' and

;'U'.

tb1_dta data 0xffff,0xaa55 ;Places 3fffh and 2a55h in

;two consecutive program

;memory locations. As program

;memory is 14-bit wide,

;the last nibble can store

;a maximum value 3.

end


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