Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Controlling a servo in C

Status
Not open for further replies.
I want to create a simple servo controller in C language, but I dont know know how to use C to create timing. I want to use 1.75millesecond pulses to control a servo to a position but I dont know how to create 1.75millesecond pulses. Please help me.
 

futz

Active Member
I want to create a simple servo controller in C language, but I dont know know how to use C to create timing. I want to use 1.75millesecond pulses to control a servo to a position but I dont know how to create 1.75millesecond pulses. Please help me.
Don't use C to create the timing! Use the PIC's timers. Have a look at Pommie's code in this thread.

If you're newbier than that, there's some simple servo control discussion in this thread, along with a very simple C servo control demo. Be aware though, that demo code of mine there is NOT the proper way to control a servo. It's only a quick demo. The proper way is to use timers and interrupts.
 
Last edited:
Status
Not open for further replies.

EE World Online Articles

Loading
Top