Hello. I've built simple R-2R 8 bit DAC and hooked it to PIC MCU.

The code looks like this:

Code:
DO
PORTB=%00000001
NOP
PORTB=%00000010
NOP
PORTB=%00000100
NOP
LOOP
And so on, this is just a fragment to get idea.

Now the output frequency is determined by MCU clock, and time needed for PORTB operation and nop operation. But how control it in realtime?
I want to hook a simple piano keyboard, and to be able to play at least 2-3 octaves.

PAUSE/PAUSEUS does not provide required precision, is there any way to replace "nop" with adjustable delay in above code?

I'm using PIC16F870, but I can use any other in 16 or 18 family.