Jump to content
Sign in to follow this  
Joan

PicAnt IDE Delays

Recommended Posts

The following codes have only 1 deferent line ... in the first code the line is

delay_us(16);

in the second code the line is

delay_us(15);

 

This code generate a 22.5us Delay

 

#include

 

char num;

 

main()

{

   trisio = 00001000b; // ( Output=0;Input=1 GP5,GP4,GP3,GP2,GP1,GP0)

   cmcon = 7;    

   gpio = 0x00;

   num=0;

   

   while (1)

   {

gpio = num;

delay_us(16);

num++;

   }

   

}

 

This code generate a 12.5ms delay

 

#include

 

char num;

 

main()

{

   trisio = 00001000b; // ( Output=0;Input=1 GP5,GP4,GP3,GP2,GP1,GP0)

   cmcon = 7;    

   gpio = 0x00;

   num=0;

   

   while (1)

   {

gpio = num;

delay_us(15);

num++;

   }

   

}

 

I use a 12F629 with internal 4MHz clock. Why is the compiler generating 2 different frequencies?

 

Regards;

Joan

B)

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...