Total members 11895 |It is currently Sun Dec 22, 2024 6:20 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Motor DC Speed Control by switching ON and OFF for short time
Code:

TITLE 
"MoTOR SPEED CONTROL"
list p=16f877
include 
<p16f877.inc>
BANK0 macro
bcf STATUS
,RP0
bcf STATUS
,RP1
endm

BANK1 macro
bsf STATUS
,RP0
bcf STATUS
,RP1
endm

BANK2 macro
bcf STATUS
,RP0
bsf STATUS
,RP1
endm

BANK3 macrc
bsf STATUS
,RP0
bsf STATUS
,RP1
endm

OFF EQU 0
;MOTOR oFF
DELAY_TIME EQU 0x20
;
ORG 0
NOP 
GOTO START
; MAIN ROUTINE

 
ORG 0x20
START CALL INITP 
;INITIALISE PoRT
MOVLW 1 
;SET MOTOR CW
MOVWF PORTE 
;AND OUTPUT
MOVLW 0 
;SET MOToR CW
MOVWF PORTA 
;AND OUTPUT
CALL START_DELAY 
;WAIT
AGAIN MOVLW 0FF 
;SET MOToR oFF
MOVWF PORTE 
;AND oUTPUT
MOVWF PORTA
CALL OFF_DELAY 
;WAIT
MOVLW 1 
;SET MOToR CW
MOVWF PORTE 
;AND OUTPUT
MOVLW 0 
;SET MOToR cW
MOVWF PORTA 
;AND oUTPUT
CALL ON_DELAY 
;WAIT
GOTO AGAIN 
;DO FOR EvER

;*******


;
 ON DELAy
ON_DELAY
MOVLW 0x80 
;SET DELAy TIME
MOVWF DELAY_TIME
WAIT1 INCFSZ DELAY_TIME 
;OoUNT DoWN
GOTO WAIT1
RETURN

;
 OFF DELAY ROUTIN
OFF_DELAY
MOVLW 0x8O 
;5ET DELAY TIME
MOVWF DELAY_TIME
WAIT2 INCFSZ DELAY_TIME 
;COUNT DOWN
GOTO WAIT2
RETURN

;
 START DELAY ROUTIN
START_DELAY
MOVLW 0x80 
;SET DELAy TIME
MOVWF DELAY_TIME
WAIT3 INCFSZ DELAY_TIME 
;CoUNT DoWN
GOTO WAIT3
RETURN

;
 PORT INITIALISATION 
INITP BANK1
; SET TO BANK 1
      MOVLW 06 
; MAKE PORT A DIGITAL
      MOVWF ADCON1
      BCF PORTA
,5; MAKE BIT 5 OUTPUT
      CLRF TRISE 
; SET PORT E TO OUTPUT
      BANK0 
; BACK TO BANK 0
      RETURN 
END




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Motor DC Speed Control by switching ON and OFF Assembly
 Infra Read Sensor to Control DC motor Assembly     -  
 Controlling the DC motor , Motor rotate clockwise Assembly     -  
 Control scroll speed using JQuery     -  
 Hide, show and toggle effects with speed control     -  
 TEMPERATURE AND HEAT CONTROL Assembly     -  
 Control Directives usage PIC assembly     -  
 Speed Painting     -  
 calculate speed of a car in javaCV     -  
 Worth switching to Cat 6 cabling?     -  
 Slide automatically-specific speed to a determined position     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com