Come on Skimask![]()
Come on Skimask![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Can someone please explain me how to use assembly to make shorter delay than pauseus can make ?
Hi,
The shortest possible delay is achieved by using the assembler command NOP (short for No OPeration):
The NOP instruction takes 1uS at 4Mhz and 250nS at 20Mhz etc. If you want longer delay add more NOP instructions or build a loop, but then it's probably easier to use PauseUs anyway.Code:@NOP 'Delay for OSC/4
/Henrik Olsson.
Therian,
Yes, that is correct. With a 4Mhz X-tal one intruction cylce is 1uS and since the NOP command takes one cycle to execute the delay will be 1uS.
/Henrik Olsson.
just curious, is 250nS enough to generate radio frequency directly from pic without any rf modules, it sound like cheap radio link
Therian,
Well, let's see:
This, I think, will generate a pulsetrain with 50% duty cycle. The frequency would be ~833kHz. Not much of a radio frequency.... besides that, you can't do anything else in the code without slowing it down more...much more.Code:Start: PortB.1 = 1 'Set pin high @ NOP 'Wait....Two NOP's are neede if we want 50% dutycycle @ NOP 'since the GOTO takes two instruction cylcles. PortB.1 = 0 'Set pin low Goto Start 'Do it again. The GOTO takes the same time as two NOP's
/Henrik Olsson.
Bookmarks