Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/00 22:56
Read: times


 
#1606 - RE: Branch
Hi Martin,

I think you are wrong on this forum,
since you mean the AT90S8518,
which is not an 8051 member,
its an AVR.
Neverseless you must jump around
the interrupt vectors only if
you use interrrupts.
So on using no interrupts your code can start directly at 0x0000.
On AVR you must use the RJMP instruction to do jump.
Branch means always a conditional jump.

Also on 8051 you need no stack initializing since it point already to a usable location (0x0007).
On the AVRs its more difficult, since there are 3 different ways:
Some device e.g. ATtiny15 has a 3 level hardware stack, which can not be initialized.
The ATtiny22 has only 128 byte RAM, so only a low byte stack pointer must be set.
But be aware, in opposition to the 8051 on the AVR after reset the stack was set to 0x0000, which was an unusable value.
So you must change the stack to e.g. 0x00DF
whenever you want to call a function or enable an interrupt.
Also e.g. on the 8515 you must set a 16 bit value SPL and SPH, to a usable location.

Since the AVR was developed later than the 8051, I understand not, why the stack was placed to an unusable location after reset, but its done
and you must live with it.

Also a hard disadvantage on the AVR was the different handling of interrupt
bits, which can never be set but must set to be cleared or can only be cleared
by special conditions.
E.g. on the 8051 a typical polling
transmit was realized by setting the TI bit, but on the AVR the TXC bit can not be set. So you need an extra bit to solve the case, that a byte was sent or not.
E.g. the source code: "if x = 1 then x = 1" looks crazy but was typical on the AVRs to poll on interrupt bits.
On the 8051 interrupt bits act similiar to every other bits. I like it, since I test interrupt handlers at first in the polling mode, and only if it works, as real interrupt routines.


Peter


List of 6 messages in thread
TopicAuthorDate
Branch            01/01/70 00:00      
RE: Branch            01/01/70 00:00      
RE: Branch            01/01/70 00:00      
RE: Branch            01/01/70 00:00      
RE: Branch            01/01/70 00:00      
RE: Branch            01/01/70 00:00      

Back to Subject List