This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
project:journal [2007/04/27 00:21] 127.0.0.1 external edit |
project:journal [2009/09/01 10:04] (current) robm Correcting instruction duration calculations |
||
---|---|---|---|
Line 96: | Line 96: | ||
* PIC datasheets says every (assembly) instruction takes a single cycle (except program branches which are 2) | * PIC datasheets says every (assembly) instruction takes a single cycle (except program branches which are 2) | ||
* Running at 4MHz = 4,000,000Hz | * Running at 4MHz = 4,000,000Hz | ||
- | * Each single instruction | + | * Each oscillator cycle takes 1/4,000,000 seconds, which is 250ns |
+ | * Each instruction takes 4 cycles (except branches, which are 8), which is 1us or 2us respectively. | ||
+ | * (Thanks to Christoph for pointing this out by email) | ||
* Hence even if I was doing this in assembly, speed would still not be an issue | * Hence even if I was doing this in assembly, speed would still not be an issue | ||