cblock.....endc

Status
Not open for further replies.

AZdave

New Member
In Nigel's "PIC Tutorial One - LED's" he uses;

Code:
cblock     0x20
           count1
           counta
           countb
endc

Are each of these a defined register? Are they 8, 16 or how many bits wide?

For instance, if I define 'bucket' how many bits do I have that could be set/unset? Can the bits be manipulated like other registers?
Example using 8 bits
Code:
cblock     0x20
           bucket
endc

movlw     b'00000001'
movwf     bucket
rlf       bucket
bsf       bucket, 6
Would 'bucket' then be '01000010'?
 
All PIC registers are 8 bit, so the section of my code you quoted allocates three 8 bit variables at GPR addresses 0x20, 0x21, 0x22. The cblock/endc is an assembler directive for allocating meomory, and is described in the MPASM helpfile.

Basically it's a simpler way to allocate GPR's, than allocating each one a seperate address.
 
Thanks for the reply Nigel.

The more I learn the more dangerous I get... watch out PIC's here I come. :lol:
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…