In one of Nigel's tutorials (Tutorial 6.1 to be exact), he defines in his code
Code:
cblock 0x20 ;start of general purpose registers
count ;used in looping routines
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
LoX
Bit_Cntr
Cmd_Byte
Dev_Byte
Timer_H
Flags
Flags2
tmp1 ;temporary storage
tmp2
tmp3
templcd ;temp store for 4 bit mode
templcd2
lcdtmp
Adr_Lo ; EEPROM memory address to be accessed
Adr_Hi
DAT_VAL
_N
InputByte ; byte read from EEPROM is stored in this register
Data_Page ; EEPROM page, 0-7
OutputByte ; used for holding byte to be output to EEPROM
I2Cflags ; flag bit register
endc
Is each one of these "variables" (to sort of speak), exactly one byte?
Are these "variables" only accessible when you are in bank 0?
If the cblock 0x20 were changed to cblock 0xA0, would the "variables"
only be accessible when you are in bank 1?
Suppose I executed the following code
Code:
movlw 0x20
movwf fsr
next clrf indf
incf fsr
btfss fsr, 2
goto next
would the effect of this code basically set count, count1, counta, and countb all to zero? Would this only work when I am in bank 0?
cblock 0x20 ;start of general purpose registers
count ;used in looping routines
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
LoX
Bit_Cntr
Cmd_Byte
Dev_Byte
Timer_H
Flags
Flags2
tmp1 ;temporary storage
tmp2
tmp3
templcd ;temp store for 4 bit mode
templcd2
lcdtmp
Adr_Lo ; EEPROM memory address to be accessed
Adr_Hi
DAT_VAL
_N
InputByte ; byte read from EEPROM is stored in this register
Data_Page ; EEPROM page, 0-7
OutputByte ; used for holding byte to be output to EEPROM
I2Cflags ; flag bit register
endc
Is each one of these "variables" (to sort of speak), exactly one byte?
Yes and no... You can access them by name in operands when in Bank 0... You can access them indirectly using the FSR and INDF registers with the STATUS register IRP bit = 0 (you can indirectly access 000..0FF with IRP=0 and access 100..1FF with IRP=1)...
If the cblock 0x20 were changed to cblock 0xA0, would the "variables"
only be accessible when you are in bank 1?
Yes and no... You can access them by name in operands when in Bank 1... You can access them indirectly using the FSR and INDF registers with the STATUS register IRP bit = 0 (you can indirectly access 000..0FF with IRP=0 and access 100..1FF with IRP=1)...
Suppose I executed the following code
Code:
Code:
movlw 0x20
movwf fsr
next clrf indf
incf fsr
btfss fsr, 2
goto next
would the effect of this code basically set count, count1, counta, and countb all to zero? Would this only work when I am in bank 0?
Yes, this code would clear locations 20h through 23h... You can access 256 contiguous locations using indirect addressing... Locations 000h through 0FFh with the STATUS register IRP bit = 0 and locations 100h through 1FFh with IRP = 1... Pretty wierd, huh?