Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

external interrupt speed

Status
Not open for further replies.

aruna1

Member
guys if i have 12f675 with external 20MHz crystal oscillator what is the maximum external interrupt speed it can have?(within safe margins ,without loosing any interrupts)
is there any theory or equation to calculate this so i can calculate speed for other pics
and does this speed depends on programming language or compiler? (i use CCS C 4.084)
 
Last edited:
The speed is limited to how long your ISR takes to handle the interrupt. If your ISR was just,

Code:
ISR	bcf	INTCON,INT0IF
	retfie
Then it will take 7 cycles to complete and so in theory you could have an interrupt every 1.4uS.

In reality, you would normally have context saving (adds 8 cycles) and some useful code which would take you to a minimum of around 20 instruction cycles which is 4uS.

To work it out, count the cycles taken by your ISR and add 4 (for latency) and divide by 5 (for 20MHz).

Edit, in C you would have to look at the generated code.

Mike.
 
Last edited:
The speed is limited to how long your ISR takes to handle the interrupt. If your ISR was just,

Code:
ISR	bcf	INTCON,INT0IF
	retfie
Then it will take 7 cycles to complete and so in theory you could have an interrupt every 1.4uS.

In reality, you would normally have context saving (adds 8 cycles) and some useful code which would take you to a minimum of around 20 instruction cycles which is 4uS.

To work it out, count the cycles taken by your ISR and add 4 (for latency) and divide by 5 (for 20MHz).

Edit, in C you would have to look at the generated code.

Mike.

well I'm not sure about cycle thing,(i dont know how to count a cycles.i have no basic knowledge i only know to write a code:confused:)all i want to do is count interrupts.if count is 10 then do some work
 
well interrupts routine will using only for about 10seconds.in that time only ting it will do is counting interrupts.after 10 seconds it will turn off interruputs
 
Why not tell us what you are doing. You may be able to use a counter or something.

Mike.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top