Schematic for this?

Thread Starter

stanman11

Joined Nov 23, 2010
228
I'm looking for a schematic close to what I need.
PWM
servo control
1 button
(on) Left: (off) Center: (on) Right (off) Center:
Then reset to The First command.


Sorry for explaining it that way, I have ADHD and its hard for me to explain.

I have a programming and PIC ready for this
 

SgtWookie

Joined Jul 17, 2007
22,230
Hello Stanman
I'm looking for a schematic close to what I need.
PWM
servo control
1 button
(on) Left: (off) Center: (on) Right (off) Center:
Then reset to The First command.
OK, let me try to understand what you wrote.

You need to control a servo via PWM.
As I understand it, a servo requires a pulse every 20mS; the pulse width is what determines the position of the servo. A pulse 1.5mS wide has the servo centered, a pulse 1mS wide has the servo at one limit, a pulse 2mS has the servo at the other limit.

You have a Microchip PIC and some programming code that apparently are "ready to go".
You should post the source code that you are planning on using, and tell us what the part number of the PIC uC is - or post a link to where you copied the code from.

You mention 1 button, and the sequence of operation is:
1) Switch off (released) - servo centered.
2) Switch on (depressed) - servo full left.
3) Switch off (released) - servo centered.
4) Switch on (depressed) - servo full right.
5) Go to step 1

Is that correct? You only want one pushbutton switch?

If so, you will need to tell us not only what PIC uC that you have, its' package type, and also what I/O pin you need the switch on, and whether the switch needs to connect to GND, Vdd, or perhaps another pin when pressed.
 

Markd77

Joined Sep 7, 2009
2,806
Assuming you are using the PIC10F200 mentioned in the other thread:
VDD and servo red wire -> +5V
VSS and servo black wire -> 0V
GP2 -> other servo wire (maybe white)
GP0 -> normally open pushbutton -> 0V
VDD -> 100nF capacitor -> VSS
+5V -> 100μF capacitor -> 0V

GP0 has a (software controlled) internal pullup resistor so nothing else is required, and it will be programmable in circuit (don't press the pushbutton while programming).
 

Thread Starter

stanman11

Joined Nov 23, 2010
228
This is all very confusing to me lol. maybe I should pick a different hobby lol
yeah im using the PIC10f200
Would you be able to set me on the right path on how to get started?
what should be my first step?
 

Markd77

Joined Sep 7, 2009
2,806
I suppose the first step is to make the simplest program that just sets the pins to high so you can check that your programming setup is working.
Start with the template from:
c:/Program Files/Microchip/MPASM Suite/Template/Code

Rich (BB code):
;********************************************************************** 
;   This file is a basic code template for assembly code generation   * 
;   on the PIC10F200. This file contains the basic code               * 
;   building blocks to build upon.                                    * 
;                                                                     * 
;   Refer to the MPASM User's Guide for additional information on     * 
;   features of the assembler (Document DS33014).                     * 
;                                                                     * 
;   Refer to the respective PIC data sheet for additional             * 
;   information on the instruction set.                               * 
;                                                                     * 
;********************************************************************** 
;                                                                     * 
;    Filename:        xxx.asm                                           * 
;    Date:                                                            * 
;    File Version:                                                    * 
;                                                                     * 
;    Author:                                                          * 
;    Company:                                                         * 
;                                                                     *  
;                                                                     * 
;********************************************************************** 
;                                                                     * 
;    Files Required: P10F200.INC                                      * 
;                                                                     * 
;********************************************************************** 
;                                                                     * 
;    Notes:                                                           * 
;                                                                     * 
;********************************************************************** 
 
    list      p=10F200            ; list directive to define processor 
    #include <p10F200.inc>        ; processor specific variable definitions 
 
    __CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF 
 
; '__CONFIG' directive is used to embed configuration word within .asm file. 
; The lables following the directive are located in the respective .inc file.  
; See respective data sheet for additional information on configuration word. 
 
 
 
 
;***** VARIABLE DEFINITIONS 
temp    EQU     0x10        ;example variable definition 
 
 
 
;********************************************************************** 
    ORG     0xFF             ; processor reset vector 
 
; Internal RC calibration value is placed at location 0xFF by Microchip 
; as a movlw k, where the k is a literal value. 
 
    ORG     0x000             ; coding begins here 
    movwf   OSCCAL            ; update register with factory cal value  
 
 
 
 
start     
    nop                       ; example code 
    movlw   0xFF              ; example code 
    movwf   temp              ; example code 
 
; remaining code goes here 
 
 
 
 
 
 
    END                       ; directive 'end of program'
You just need a few lines to clear the TRIS bits and set the GPIO bits, then put in an empty loop to stop the code from rolling back to the start again.
<ed> Also change the config line to :
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF
</ed>
The next step I'd recommend is getting to know the simulator in MPLAB, then looking at some code examples.
My reply in the the thread in Electronics Resources has some code which does almost what you want.
Once you get started it gets easier quickly.
 
Last edited:
Top