Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

anyone using Pic16f452 ?

Status
Not open for further replies.

tinhnho

Specifier/Regulator
Apr 28, 2006
6
can you tell me what is the best instruction which does not affect the program counter?

Thanks
 
Replies continue below

Recommended for you

Uh, stopping the clock might do it, but I don't think there's an instruction for that. And if there were, you'd never be able to execute the next instruction under program control.

By way of illumination, let me ask you this: Why would you want to 'not affect' the program counter?



Mike Halloran
Pembroke Pines, FL, USA
 
Where I'm going is this:

I suspect that you are perhaps new to embedded system programming, and are asking a perfectly logical, classical 'noob' question, "How do I get my program to stop, and wait for an input, and then start up again?" "When I program in a 'stop' command, it just stops, and never restarts."

The answer is, you write the program so it never, never, ever stops running, it just stops _appearing_ to do anything, but it really runs in a loop, constantly polling the input, i.e., asking the same switch, over and over, "Did the idiot out front do anything?", and repeating until it gets an answer different from "no".

I hope that helped, or at least didn't insult you.



Mike Halloran
Pembroke Pines, FL, USA
 
Or you setup the appropriate interrupt and then execute the sleep instruction. The processor then sleeps until the interrupt occurs.

Keith Cress
Flamin Systems, Inc.-
 
you're right, i just started doing this about 2 months by myself, i bought few book and learn at home when i have time, i also bought some equipments to practice at home, thanks for the answer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor