Continue to Site

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!

Status
Not open for further replies.

Helios64

New Member
Hi guys,
I'm new to this forum. I bet this has been asked several times in the past. I need to control a digital servo in both directions by using a pot. Is there any practical project handy? or a PIC project available?

Many thanks,

Mark :)
 
Hi guys,
I'm new to this forum. I bet this has been asked several times in the past. I need to control a digital servo in both directions by using a pot. Is there any practical project handy? or a PIC project available?

Many thanks,

Mark :)

You could do it with a 555 timer chip, search for '555 Servo Tester', several out there.

Don't use PIC, but guess it might work, if that's all you got to work with... :)

Seriously, if all you want is to position the servo with a pot, the 555 is the cheap and simplest. Might look up PPM... A 1.5 mS pulse is center position, 1.0 mS and 2.0 are about 90 degrees either direction, and you can go anywhere in between and beyond (if the physical stop breaks off...).
 
Help please!

Thanks HarveyH42

Yes I am aware of the 555. However I wanted to try PICs as a matter of learning and also problem solving. I came across a schematic and a source code for the almighty 16F675 which is supposed to provide precise control for the connected servo(s). When I try to compile it, my compiler returns so many errors like: redefinition of label retlw or movf or subwf or btfss etc. I use the Microstudio Basic Pro compiler.
Since I am a newbee to the microcontrollers, I would appreciate someone looking into the program and advise me as to how to solve this problem. I'm a 80's electronics engineer, those years we had to deal with TTL and CMOS to build and design our circuits! Anyways it's not late to learn even for an old man, is it? :)
I attach the program for your perusal.

Thank you,
Mark.
 

Attachments

  • servotester.txt
    7.6 KB · Views: 207
Can anyone help please?

I came across a schematic and a source code for the almighty 16F675 which is supposed to provide precise control for the connected servo(s). When I try to compile it, my compiler returns so many errors like: redefinition of label retlw or movf or subwf or btfss etc. I use the Microstudio Basic Pro compiler.
Since I am a newbee to the microcontrollers, I would appreciate someone looking into the program and advise me as to how to solve this problem. I'm a 80's electronics engineer, those years we had to deal with TTL and CMOS to build and design our circuits! Anyways it's not late to learn even for an old man, is it?
I attach the program for your perusal.

Thank you,
Mark.
 

Attachments

  • servotester.txt
    7.6 KB · Views: 174
I got it to compile with MPLab v.8.1

I made a number of changes and am not sure exactly which ones are important and which are not.

The two that seem most important are:

1) The header is screwed up. Start with a new project using the project wizard and be sure to add the appropriate source (.asm) and header (.inc) files. The header name is P12F675.inc. Be sure to disable case sensitivity. (Right click on the asm file in the MCP tree, and under build options, click on the disable case sensitivity box.)

2) "addlw" is not an instruction for the 12F675. I substituted "andlw". CAUTION: I did not study the whole program to find out if that made sense. It may be addwf or some other instruction. I just picked something I figured would build. At least now, you can play with the choice of the instruction to get something that works.

Finally, replace the return with retlw 0 . I don't believe that change is necessary, as MPLAB will probably make the changes for you.

I am really a novice at this. I get a project to work. Then, I don't touch the stuff for several months. It's been a few months, so my approach here was simply "how to get it to build."

Good luck. John
 
Can you post a link to the schematic? It is something I may want to build later in the year. It would also help me understand the code.

John
 
John

Hi, here is the link to the web page: "www.electronics-lab.com/projects/motor_light/008/index.html"
you'll find the assembly code on the bottom of the page.

Please let us know what you think.

Thank you,

Mark.
 
That looks like a pretty good tester. I like the sweep function. The 12F675 should be more stable than the 555-based testors, which is good for digital servos.

Unfortunately, I am just finishing another project right now, so it will be awhile before I can get to it. Please update this thread as you progress, and I will do the same.

John
 
Servo tester with 12F675

I found the same problems to compile the file serve675c.asm. I found an error in this file the line "# include <12f675.inc>" is the correct # include <p12f675.inc>.
Made fix to build in MPLAB was ok.

I have tested the circuit "www.electronics-lab.com/projects/motor_light/008/index.html", it work fine.
 

Attachments

  • serv675c.HEX.txt
    1.5 KB · Views: 177
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top