Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 23rd January 2005, 03:35 PM   (permalink)
Default cblock.....endc

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'?
__________________
Dave
Life may not be the party we hoped for, but while we are here we might as well dance.
AZdave is offline   Reply With Quote
Old 23rd January 2005, 06:38 PM   (permalink)
Default

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 23rd January 2005, 08:30 PM   (permalink)
Default

Thanks for the reply Nigel.

The more I learn the more dangerous I get... watch out PIC's here I come. :lol:
__________________
Dave
Life may not be the party we hoped for, but while we are here we might as well dance.
AZdave is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 12:09 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.