Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] PIC18F2550 how many nops for 1us delay?

Status
Not open for further replies.

Alloy

Advanced Member level 4
Joined
Apr 3, 2016
Messages
116
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
1,003
Hey
I have a PIC18F2550 board with bootloader.
I want to do a 1 us delay with nops.
Something like: nop() nop() nop() nop().
And I only know that board is using 16MHz crystal.
I dont know anything about the other configuration bits of the board because I did not set them (they are preprogrammed with bootloader)
How many nop() should I use?
 

You told nothing about the language and compiler that you're using, but some of them have high level delay functions whose calculations and the need or not to add nop()'s for tune desired value is made during compilation.
 

Assuming that you are running the PIC at 48Mhz you would need 12 nops to make 1uS.
 

Just make sure that the compiler optimiser translates the 'Nop()' code that you are using to a single assembly 'nop' instruction and does not optimise the code away. Complilers might each do this ina different way so you need to investigate ths properly.
Susan
 

In addition, as a general advice, adding a stream of nop() commands in some high level language would turn the code intrinsically dependent of the current Fosc, turning any porting to other design more prone to fail.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top