Jump to content

12f629


Recommended Posts

Hi,

I have a problem getting a 12f629 to perform a long timing loop.

 

The 'delay_s();' doesn't appear to allow for a very long delay (I'm looking for 2 hours), so I put a while loop incrementing and calling the delay every loop.

 

This too fails to work(stopping after a few minutes).

Does anyone know why this is a problem.

 

unsigned int a;

while(a<212)

{

delay_s(60);

a++;

}

 

I am using the internal clock and have tried changing the clock speed but no joy.

 

Regards,

Daz.

Link to comment
Share on other sites

This too fails to work(stopping after a few minutes).

Does anyone know why this is a problem.

 

unsigned int a;

while(a<212)

{

delay_s(60);

a++;

}

 

I am using the internal clock and have tried changing the clock speed but no joy.

 

Regards,

Daz.

 

 

You forgot to initialise variable a

 

Regards, Andrew

Edited by asmallri
Link to comment
Share on other sites

Daz,

 

How do you know that its not working ?

 

Have you trying this code under the sourceboost simulator, you can use the stop watch plugin to measure the time.

 

Regards

Dave

Link to comment
Share on other sites

Daz,

 

How do you know that its not working ?

 

Have you trying this code under the sourceboost simulator, you can use the stop watch plugin to measure the time.

 

Regards

Dave

Hi Dave,

I know it's not working because I have hardware driving an led and I've timed it.

 

I don't believe the simulator supports the 12f629 (pin names differ i.e. gpio - portb etc.).

 

regards,

Daz.

Link to comment
Share on other sites

Daz,

 

I don't believe the simulator supports the 12f629 (pin names differ i.e. gpio - portb etc.).

 

You can use the simulator to simulate the execution of the delays, even if the I/O is not supported.

 

Are you sure nothing else is resetting the CPU - watch dog, or external hardware.

 

 

Regards

Dave

Edited by Dave
Link to comment
Share on other sites

Daz,

 

I don't believe the simulator supports the 12f629 (pin names differ i.e. gpio - portb etc.).

 

You can use the simulator to simulate the execution of the delays, even if the I/O is not supported.

 

Are you sure nothing else is resetting the CPU - watch dog, or external hardware.

 

 

Regards

Dave

Hi Dave,

I'll try to simulate as you suggest.

 

Watchdog - good point, it hasn't been turned off.

 

Regards,

Daz.

Link to comment
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...
 Share

×
×
  • Create New...