Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

Back
Top