Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 15th February 2009, 10:30 PM   #1
Default Controlling a servo!

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
Helios64 is offline  
Old 16th February 2009, 12:48 AM   #2
Default

Quote:
Originally Posted by Helios64 View Post
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...).
HarveyH42 is offline  
Old 16th February 2009, 10:01 AM   #3
Default 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.
Attached Files
File Type: txt servotester.txt (7.6 KB, 39 views)
Helios64 is offline  
Old 17th February 2009, 08:45 AM   #4
Default 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.
Attached Files
File Type: txt servotester.txt (7.6 KB, 24 views)
Helios64 is offline  
Old 17th February 2009, 03:46 PM   #5
Default

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
jpanhalt is online now  
Old 18th February 2009, 10:00 AM   #6
Default

Thank you John
Very grateful to you. I'll give it a go.

Cheerio

Mark
Helios64 is offline  
Old 18th February 2009, 10:37 AM   #7
Default

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
jpanhalt is online now  
Old 18th February 2009, 02:58 PM   #8
Default

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.
Helios64 is offline  
Old 18th February 2009, 03:41 PM   #9
Default

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
jpanhalt is online now  
Old 19th February 2009, 09:26 PM   #10
Default

Hey check out this post it has some stuff about the 675 running a couple of servos. adc two servos 12f675 If that isn't enough help I can send you a schematic and a program that runs a single servo very well using a pot.
__________________
jeremy
jeremygaughan is offline  
Old 2nd November 2009, 12:14 PM   #11
Default 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.
Attached Files
File Type: txt serv675c.HEX.txt (1.5 KB, 4 views)

Last edited by Joca; 3rd November 2009 at 11:07 AM.
Joca is offline  
Reply

Tags
controlling, servo

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Controlling a servo motor using a Key Fob? MechDoc Electronic Projects Design/Ideas/Reviews 0 25th January 2009 06:08 PM
Controlling a servo in C iforgotasemicolon Micro Controllers 1 5th January 2009 07:05 PM
Controlling a Servo Motor shaneshane1 General Electronics Chat 61 18th November 2007 07:58 AM
Controlling a Servo Covracer Micro Controllers 4 16th June 2004 03:19 PM
DTMF for controlling Servo Mwafaa General Electronics Chat 1 27th May 2003 08:46 AM



All times are GMT. The time now is 02:59 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker