Society of Robots - Robot Forum
Software => Software => Topic started by: 1sam3 on March 30, 2008, 01:42:26 AM
-
hi, i am honestly not that good in progamming, so plz if any1 can help..
am trying to controll a brushed dc motor and a stepper motor via my pic 18f452- microcontroller. the job of the first motor is to rotate a base of a satellite dish ~360degress, the second motor's is to tilt dish up-down.
i need to find a way to write a c program, and use it on mplab to control the motors..
code..
-
Are you asking how to program in C? Search for programming tutorials.
Or how to program PWM on a PIC? Google for sample code, there is tons out there . . .
-
well i kind of know how to program on C but i wont consider myself any good, thats why i need to find someway to write a simple program down to control the satellite dish motors and by that control its movement/position. almost all the component are connected to My PIC18f420 microcontroller..
-
Take a look at this tutorial. It should get you on the right path!
http://ulcape.org/wiki/Tutorial-PIC_Programming_Basics
Aside from the programming side of things you are still going to need an h-bridge to control the motor, and some sort of sensing device (pot or shaft encoder?) on the DC motor in order to determine its position. If the reason you are using a stepper motor is for positioning I suggest you just use 2 DC motors with optical shaft encoders on them. Steppers are much more difficult to drive from, and require a rather large voltage source compared to the rest of your electronics. Also be sure you consult the data sheet about what oscillator to use, and anything else you may be curious about your particular PIC.
-
thanks, but i already am gonna build a h-bridge and get an encoder for the dc motor i got. my first choice was to get 2 dc motors, but then my lecturer suggested i use a stepper motor for the tilt operation of the dish because its much more accurate..