Hallo!

Es Betrift den PIC18F252, aber wahrscheinlich gilt für alle PIC18FXXX.

Ich wollte, eine Sequenz:

nop
nop

durch

goto $+2

ersetzen.

Gemessene Ausführungszeit beträgt aber 3 anstatt 2 Takten. Natürlich ein Befehl $+1 schickt den Prozessor in "Nirvana", weil die Adressen nur gerade seien dürfen. Wen jemand eine Verzögerung um 3 Takte braucht, kann also "goto $+2" anwenden.

Erklärung vom Microchip Forum, wo ich selbstverständlich nachgefragt habe:

The second instruction word of all of the 2-word instructions has '1111' in its upper nibble. This will make it always execute as a 'nop'.

If this weren't the case, a skip instruction followed by a 2-word instruction wouldn't work correctly since the PIC would execute something unintended. Execution would be unpredictable in that it would be determined by whatever happened to be in that second instruction word.

MfG