caramoan tour package

caramoan tour package

Author Topic: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help  (Read 589 times)

Offline chicobulilit

  • Size D Battery
  • ******
  • Posts: 283
  • Pogi/Ganda Points: 1
  • Gender: Male
  • makoto "The truth"
>>nid help po ung program how to move the stepper motor by variable...
>>kasi di naman po continous ung galaw.... kahit mg 2-3 revolutions lang po...
>>using MPlab po...
>>port A will be the output pins and port b are input..
>>e2 ung ginwa kong program(using a tutorial i found on the net... but the stepper motor continues to rotate
>>can anyone debug this for me... pls thanks....
>>kung may kulang pa po sa syntax... kindly edit lang po..... salamat


NUMBER EQU 0X0C
;X>>>LEFT           Y>>>RIGHT
MAIN
 BSF STATUS,RP0
 MOVLW 0X00
 MOVWF TRISA
 MOVLW 0XFF
 MOVWF TRISB
 BCF STATUS, RP0
   BTFSS PORTB, 0X00
START
 BTFSC  PORTB,0
 GOTO   X
 BTFSC  PORTB,1
 GOTO   Y
 GOTO START
X MOVLW 0X01
 MOVWF PORTA
 CALL DELAY
 MOVLW 0X02
 MOVWF PORTA
 CALL DELAY
 MOVLW 0X04
 MOVWF PORTA
 CALL DELAY
 MOVLW 0X08
 MOVWF PORTA
 CALL DELAY
 GOTO START
Y MOVLW 0X08
 MOVWF PORTA
 CALL DELAY
 MOVLW 0X04
 MOVWF PORTA
 CALL DELAY
 MOVLW 0X02
 MOVWF PORTA
 CALL DELAY
 MOVLW 0X01
 MOVWF PORTA
 CALL DELAY
 GOTO START
DELAY
 BSF STATUS,RP0
 MOVLW 0X05
 MOVWF OPTION_REG
 BCF STATUS, RP0
 CLRF TMR0
 MOVLW 0X5
 MOVWF NUMBER
X2
 BCF INTCON,T0IF
X1
 BTFSS INTCON,T0IF
 GOTO X1
 DECFSZ NUMBER
 GOTO X2
 RETURN
END
"there is always a better plan"
                                 -ketchup

Philippine Electronics Forum


Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2859
  • Pogi/Ganda Points: 203
  • Gender: Male
    • Tiktakx's Blog
Re: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #1 on: December 17, 2009, 11:42:42 AM »
mas madaling gawin ito sa C ;D ;D ;D
8051 stuff

Philippine Electronics Forum

Re: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #1 on: December 17, 2009, 11:42:42 AM »

Offline motion55

  • Technical People
  • Diesel Generator
  • *****
  • Posts: 1878
  • Pogi/Ganda Points: 243
  • Gender: Male
  • Been at this longer than you've been alive.
Re: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #2 on: December 17, 2009, 08:45:03 PM »
Here is my mod. Modifications are highlighted in red. I assume you are using a 1.8 degree/step motor.

Quote
NUMBER EQU 0x0C
STEPS  EQU 0x0D
;
;X>>>LEFT           Y>>>RIGHT
MAIN:
   BSF STATUS,RP0
   MOVLW 0x00
   MOVWF TRISA
   MOVLW 0XFF
   MOVWF TRISB
   BCF STATUS, RP0
   BTFSS PORTB, 0x00
START:
   MOVLW  0x64   ; 0x64 x 4 = 400 full-steps = 2 rev
   MOVWF  STEPS
   BTFSC  PORTB,0
   GOTO   X
   BTFSC  PORTB,1
   GOTO   Y
   GOTO START
X:
   MOVLW 0x01
   MOVWF PORTA
   CALL DELAY
   MOVLW 0x02
   MOVWF PORTA
   CALL DELAY
   MOVLW 0x04
   MOVWF PORTA
   CALL DELAY
   MOVLW 0x08
   MOVWF PORTA
   CALL DELAY
   DECFSZ STEPS,F
   GOTO   X
   GOTO START
Y:
   MOVLW 0x08
   MOVWF PORTA
   CALL DELAY
   MOVLW 0x04
   MOVWF PORTA
   CALL DELAY
   MOVLW 0x02
   MOVWF PORTA
   CALL DELAY
   MOVLW 0x01
   MOVWF PORTA
   CALL DELAY
   DECFSZ STEPS,F
   GOTO   Y
   GOTO START
DELAY:
   BSF STATUS,RP0
   MOVLW 0x05
   MOVWF OPTION_REG
   BCF STATUS, RP0
   CLRF TMR0
   MOVLW 0x5
   MOVWF NUMBER
X2:
   BCF INTCON,T0IF
X1:
   BTFSS INTCON,T0IF
   GOTO X1
   DECFSZ NUMBER,F ; fix a potential bug here.
   GOTO X2
   RETURN
END
"Set your mind free!"

Philippine Electronics Forum

Re: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #2 on: December 17, 2009, 08:45:03 PM »

Offline chicobulilit

  • Size D Battery
  • ******
  • Posts: 283
  • Pogi/Ganda Points: 1
  • Gender: Male
  • makoto "The truth"
new item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #3 on: December 17, 2009, 11:16:41 PM »
salamt po sa lahat ng nagreply :'(..... napakalaking tulong.....

kuya tiktaks

pwede mo ba ako gawan ng program..... simple lang naman requirements eh.....

sa port a inputs lang.... so cgro lets say na si RA0 at si RA1 ay mga nagiintay ng input...
so pag nakatanggap sila ng logic 1.... output kay port b which iikot si stepper motor ng 2 revolutions at may tutunog na buzzer
ung isa sa mga port a either RA0 or RA1 is push button acting as trigger.... na pag nakasagap xia ng logic 1 iikot ulit si stepper motor ng 2 revolutions pero reverse na tapos titigil si buzzer sa pag tunong.....

un lang po.... kakakuha ko lang po kasi ng compiler ng ccsc ngaun... at pinagaaralan ko pa kasi... abak kulangin sa oras.... kaya po nid help niyo....
salamt po ng marami kay kuya motion55.... di nasayang ang pagod mo..... pero kasi required pala kami na ccsc compiler ung gamitin....

sori talga...nid kasi un sa documentation eh... huhuhuhu....

last question.... gumagana ba ung hex file nung GTP-USP lite????
"there is always a better plan"
                                 -ketchup

Philippine Electronics Forum

new item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #3 on: December 17, 2009, 11:16:41 PM »

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #4 on: December 17, 2009, 11:54:21 PM »
madali lang sana to... kaso kapos ka na sa oras...

do you have a schematic? post mo na din sana...
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: item gurad with alarm(urgent.... pasahan na sa sabado...) pls help
« Reply #4 on: December 17, 2009, 11:54:21 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com