This a list of questions I still have about AVR programming that I have not been able to answer on my own.
Often I see a SFR set using syntax like this: ldi r16, (1>>SFR1|2>>SFR2). I am having trouble understanding the full functionality of this but I understand how it basically works provided the number is only a 1. Anything above I don’t understand. Could anyone help me with this? Pointing me to a resource will be great. I have had a hard time searching for it because it contains no searchable terms and I don’t know the name for this method. I have only seen it used. I also don’t believe it is in the AVR Studio help file unless it is in a corner I haven’t look in yet.
Sometimes I see the terms ‘high register’ and ‘low register’. I am wondering what these are and why they are significant.
I sometimes see the routine the reset vector points to at the very bottom of the code. I’m just wondering why this is. My guess is that this is a failsafe in case, for whatever reason the program counter falls through the end of the code. In which case it would run into the initialization block and pretty much end up doing a reset.
A couple of people have told me that it is wise to include something like this when programming a wait routine for the 8051:
Loop: sjmp, $
The second sjmp is there as a backup in the unlikely event (@ 1Mhz, unlikely events suddenly become likely ;) ) that the value pushed onto the stack is the address just after the sjmp instruction instead of address of the loop label. I haven’t seen this in any AVR program, I haven’t seen it in a lot of 8051 Programs either, actually. I’m wondering if this is true for the 8051, and more importantly, if it’s true for the AVR.
Thank you for any help you may be able to offer.