go_away

Author Topic: PWM (PIC 16F 877A) for window climbing robot...???  (Read 3276 times)

0 Members and 1 Guest are viewing this topic.

Offline katherinaTopic starter

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
PWM (PIC 16F 877A) for window climbing robot...???
« on: September 30, 2007, 11:22:57 PM »
hi, me n my partner is trying to develop a window climbing robot using the PIC 16F877A to control its operation.

Im wondering, since the PIC 16F877A has only 2 pwm, n i dun intend to control the speed of the robot which in dat case, pwm have to be used.  here, i only need to control the angle of rotation  for 3 motors.

we wanted to develop something almost similar to below for our final project (we use this as our reference, and this is where we got the idea from):

http://www.mech.utah.edu/~minor/publications/IROS00-climber.pdf


if we need to use the pwm, we need 3 pwm. however, in PIC 16F877A they only have 2 pwm... does dat mean that i have to use 2 Chips of PIC116F877A???

tq....

Offline creedcradle

  • Full Member
  • ***
  • Posts: 92
  • Helpful? 0
  • Physics Robotics
Re: PWM (PIC 16F 877A) for window climbing robot...???
« Reply #1 on: October 01, 2007, 02:13:33 AM »



if we need to use the pwm, we need 3 pwm. however, in PIC 16F877A they only have 2 pwm... does dat mean that i have to use 2 Chips of PIC116F877A???

tq....

a big NO.

i want to show you here the trick how to create a PWM with the  use of the ordinary PINs of any PIC MCU

here it goes

preconditions;
crystal is at 4 MHZ


 org 0x000 
 
INITPORT   
                   bsf     STATUS,RP0 
         movlw   00h       
         movwf   TRISB       
         bcf     STATUS,RP0   
         clrf    PORTB     
 
SIMULA     
             movlw   d'40'       
             movwf   kaliwa_cntr      
KALIWA
         bsf     PORTB, 0   
         movlw   d'1'         ;decimal value for 1ms (para sa 4MHz oscillator) 
             movwf   Delay_time   
         call    BAGAL       
 
         bcf     PORTB, 0     
             movlw   d'20'       
             movwf   Delay_time 
             call    BAGAL       
 
         decfsz  kaliwa_cntr 
             goto    KALIWA       
                                               
           
             movlw   d'40'       
             movwf   kanan_cntr   
KANAN     
         bsf     PORTB, 0     
         movlw   d'2'         
             movwf   Delay_time 
         call    BAGAL       
 
         bcf     PORTB, 0   
             movlw   d'20'       
             movwf   Delay_time   
             call    BAGAL         
 
         decfsz  kanan_cntr 
             goto    KANAN         
             call    SIMULA       
   
   
BAGAL         
        movlw d'248'   
           movwf Delay_Cntr   
delay1ms   
           nop                   
           decfsz Delay_Cntr   
           goto delay1ms   
           decfsz Delay_time   ; 1ms; 2m O 20 ms 
           goto BAGAL   
        return
             
            end     
------------------------------------------
A little math makes a PWM works
« Last Edit: October 01, 2007, 02:16:19 AM by creedcradle »
LEARN TO SHARE and SHARE TO LEARN!

Offline katherinaTopic starter

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
Re: PWM (PIC 16F 877A) for window climbing robot...???
« Reply #2 on: October 01, 2007, 05:54:04 AM »
but, dats in 'assembly' language rite?
we have to do the program in c....
i dun have any idea ???

Offline annoyin_kid

  • Full Member
  • ***
  • Posts: 91
  • Helpful? 0
Re: PWM (PIC 16F 877A) for window climbing robot...???
« Reply #3 on: October 01, 2007, 12:36:04 PM »
y not get 3 servos and mod them just change the duration of the pulse and you get different speeds? im pretty sure that you can use them on any output pin i know that you can with picaxe but im not 100% with PIC 16F877A. only problem is that you will lose a lot of speed but you'll get much more torque.

can i just ask wot the window climbing thing is for? u planning to break into a house or something?
« Last Edit: October 01, 2007, 12:37:15 PM by annoyin_kid »

Offline creedcradle

  • Full Member
  • ***
  • Posts: 92
  • Helpful? 0
  • Physics Robotics
Re: PWM (PIC 16F 877A) for window climbing robot...???
« Reply #4 on: October 01, 2007, 03:59:50 PM »
if you do it in C it is much easier,

just remember any general I/O pin can be modulated with a simple use of a loop

say

while (1)
set an I/O pin to high
delay in microsec(1000)
set the I/O pin to low
delay in microsec (20000)

it makes the servo moves forward
LEARN TO SHARE and SHARE TO LEARN!

 


Get Your Ad Here

data_list