How does bank instruction really work in SX52's ????????
sounddezign
Posts: 9
Hi guys,
I'm after a proper explaination of how the bank instruction works in the SX52. The literature I've read is divided on whether the bank instruction fails to set bit.7 or bit.4 in the FSR.
The SX key manual says you have to manually set bit.4 in the FSR
The SX52 datasheet says its bit.7
most confusing is the· "Programming the SX microcontroller by Gunther Daubach" which at the beginning says that you must manually set bit.4 and then later goes on to give an example of a macro which sets bit7 as required!
Can somebody with experience of the sx52 please explain exactly what bits are changed in the FSR when the bank instruction is used.
Thanks
Andy
I'm after a proper explaination of how the bank instruction works in the SX52. The literature I've read is divided on whether the bank instruction fails to set bit.7 or bit.4 in the FSR.
The SX key manual says you have to manually set bit.4 in the FSR
The SX52 datasheet says its bit.7
most confusing is the· "Programming the SX microcontroller by Gunther Daubach" which at the beginning says that you must manually set bit.4 and then later goes on to give an example of a macro which sets bit7 as required!
Can somebody with experience of the sx52 please explain exactly what bits are changed in the FSR when the bank instruction is used.
Thanks
Andy
Comments
It's bit 7.
Cheers,
Peter (pjv)
I think the very 1st engineering samples of the SX48/52 used bit 4, but then it was changed to bit 7 in the production units.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
I'm still confused about how to use the 16 bytes in SX48/52 variable-space bank 0.
I'm used to issuing statements like:
org $30
bank_a = $
var1 ds 1
var2 ds 1
and then in code, I do
_bank bank_a
mov var1, #0
(using the bank macro that sets or clears bit 7)
But it seems like this works for every SX48/52 bank EXCEPT bank 0.
If I try to access var0:
org $0
bank_zero = $
var0 ds 1
_bank bank_zero
mov var0, #0
then var0 points to registers, not my variable.
I guess that bank 0 of user variable space is not accessable for this sort of variable naming?
Are there any tricks that make the 16 bank zero variables easier to use?
David
What the assembler does is any variables > $0F becomes $1x (with x being the lowest 4 bits).
So "MOV $1F,#5" assembles to EXACTLY the same code as "MOV $2F,#5" or "MOV $3F,#5"
Now if you use indirect addressing (FSR,IND), then $00 to $0F access the global variables.
You CANNOT access bank 0 using indirect addressing (FSR,IND).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
you've got a lot of answers to the question in your very first post. Now , it's me, bailing in too.
When I wrote in my book that you'll have to set/clear bit 4 "manually" - this indeed was correct for the first available SX48/52 engineering samples. Later it was changed to bit 7. Seems as if you have found another typo in my book. When I wrote the very first parts of the text, the engineering samples were the only I had for testing. Obviously, I forgot to change the text from bit 4 to 7 later. Sorry for that - I'll fix it in the next edition.
BTW: I noticed that I actually wrote that the bit has to be set/cleared "manually". Beginners might be looking for a little toggle swich attached to the SX48/52 to change that bit, or even open the plastic package, searching for a toggle switch inside, soldered to the silicon - NO - NO - NO, don't do it - there is no switch . I actually wanted do say that a separate CLRB/SETB instruction is necessary to handle that bit, or you use the macro shown later in the text (modifying the correct bit).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G