CBLOCK - Define a Block of Constants

MPASM Assembler

CBLOCK - Define a Block of Constants

Syntax

cblock [<expr>]

<label>[:<increment>][,<label>[:<increment>]]

endc

Description

Define a list of named constants. Each <label> is assigned a value of one higher than the previous <label>. The purpose of this directive is to assign address offsets to many labels. The list of names end when an endc directive is encountered.

<expr> indicates the starting value for the first name in the block. If no expression is found, the first name will receive a value one higher than the final name in the previous cblock. If the first cblock in the source file has no <expr>, assigned values start with zero.

If <increment> is specified, then the next <label> is assigned the value of
<increment> higher than the previous <label>.

Multiple names may be given on a line, separated by commas.

cblock is useful for defining constants in program and data memory.

Example

cblock 0x20 ; name_1 will be assigned 20

name_1, name_2 ; name_2, 21 and so on

name_3, name_4 ; name_4 is assigned 23.

endc

cblock 0x30

TwoByteVar: 0, TwoByteHigh, TwoByteLow

Queue: QUEUE_SIZE

QueueHead, QueueTail

Double1:2, Double2:2

endc

See Also

ENDC


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