Geo*** wrote:a) I'm asking you this because latency involves= interrupt identification+ Context saving(Pushing of CPU registers) +Jump to the interrupt vector+time just before first instr of ISR is executed.
b)Is Context saving(Pushing of CPU registers) similar to normal push operation which has definite machine cycles.Or some HW logic sends to the stack on the reception of a trigger ?
My question in mind was whether any harware internal logic (super fast ??!!???) would put/place ( I would like to call this way rather than push, coz it might confuse one with executing PUSH instruction which executes with a definite machine cycle time and hence dependent on frequency clock.) these CPU registers (like in HC/HCS) on stack.
kef wrote:Some MCUs save/restore on the stack almost everything and you don't have to save/restore single byte. Others may require save/restore everything by hand. Speaking about S12, all CPU registers are saved/restored on interrupt, and in the most of applications you don't need to save/restore more than that. But if you need for example to do in ISR some manipulations to PPAGE register, then you need to save/restore PPAGE manually. Context saving is bit wider than just CPU registers.
Firstly a SWI ISR with no instructions is going to give you a lot of grief. You need at least a RTI there.
Geo*** wrote:SWI (swi ISR has no instructions)
Hmmm I'm speaking unnecessarily !!! First paragraph: I completely agree with you.But SWI is a special instruction. See my above reply for its working. There could be two options of saving/retreiving context from the stack.CPU individually executing Push instructions on register L,H,X,A ; Setting I flag
peg wrote:
All instructions take a finite amount of cycles to execute, thus they will take an amount of time proportional to the clock speed.
Unless you use the timer with an independent clock source, then you are never going to achieve this on these MPU's. Even then this is not your answer as you said software.
Geo*** wrote:...Second option could be hard wired logic which automatically does these sequentially one by one .Only HARDWARE delay involved and its fixed !!!!
kef wrote:
It is still not clear what you are trying to achieve. Do you want to determine the speed of external crystal? Then you have to use some other clock reference, for example internal RC clock.
Anyway since you asked, Internal RC clock has a deviation of +/- 2% after factory trim. Accuracy calculation of your crystal is compromised .And moreover RC oscillators' accuracy is dependent on Vdd, Temperature applied to MCU .
kef wrote:It is still not clear what you are trying to achieve. Do you want to determine the speed of external crystal? Then you have to use some other clock reference, for example internal RC clock.