Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Dc motor speed control

Status
Not open for further replies.

zak4546

New Member
need help to check if this A to D conversion and PWM initialization is right..
i am doing a 8 speed motor controller using PWM(pic 16f876). but when i turn my potentiometer it doesn't seem to increase or decrease the speed.I am using a 10MHz oscillator. If the program is correct how do i go about detecting the speed change from the potentiometer.i am using a speed detection motor to feedback the speed.Pls help!


;**************** Program Start ***********************
org 0
goto init

;**************** Initial Process *********************
init

;*** Port initialization
bsf status,rp0
movlw b'00000001'
movwf trisa
clrf trisb
clrf trisc
bcf status,rp0

;*** A/D converter initialization
movlw b'10000001'
movwf adcon0
bsf status,rp0
movlw b'00001110'
movwf adcon1
bcf status,rp0

;*** PWM initialization
clrf tmr2
movlw b'11111111'
movwf ccpr1l
bsf status,rp0
movlw d'255'
movwf pr2
bcf status,rp0
movlw b'00000110'
movwf t2con
movlw b'00001100'
movwf ccp1con

;*** Compare mode initialization
clrf tmr1h
clrf tmr1l
movlw h'61'
movwf ccpr2h
movlw h'A8'
movwf ccpr2l
movlw b'00000001'
movwf t1con
movlw b'00001011'
movwf ccp2con

;*** Interruption control
bsf status,rp0
movlw b'00000001'
movwf pie2
bcf status,rp0
movlw b'11000000'
movwf intcon
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top