Tal Bejerano - AMC wrote: > A friend (really new to pics) ask me about the NOP delay He look at > some samples at piclist archive and found that in one sample nop > gives 0.122msec he's question is: what cause the delay time? Tal: A PIC's program execution speed is dependent on the frequency of its CLKIN signal; the faster that signal is, the faster the PIC executes its programs. Most PICs can be operated with a user-selected CLKIN frequency from 0 to 20MHz; some commonly-used frequencies are 32768 Hz, 4 MHz, and 20 MHz. A NOP instruction always takes one instruction cycle. One instruction cycle is always equal to 4 CLKIN periods. The length of a CLKIN period, however, can vary from 50 nanoseconds all the way up to infinity. If a PIC is operated with a 32768 Hz CLKIN frequency, one CLKIN period is 0.0305 milliseconds. Four of those CLKIN periods is 0.122 milliseconds, which is what your friend saw. Clearly, the code he was viewing was intended to be run on a PIC with a 32768 Hz CLKIN frequency. If the same NOP instruction were executed on a PIC running at 4 MHz, it would take one microsecond; if it were executed on a PIC running at 20 MKHz, it would take 200 nanoseconds. -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body