Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Ads

Discussion Groups

Discussion Groups | AVRclub | Re: [AVR club] I need speed control example on dc motor

Atmel AVR Microcontroller discussion group.

Re: [AVR club] I need speed control example on dc motor - Bhanu Prakash - Oct 1 8:38:34 2007

hi,
You can go through the assembly code below. So that u can write in
C.
If you have any quires feal free to contact me.

.include"C:\Program Files\Atmel\AVR Tools\AvrAssembler\Appnotes\m32def.inc"

.dseg
.def temp =r16

.cseg
.org $000
rjmp bhanu

bhanu:

ldi temp,low(ramend)
out spl,temp
ldi temp,high(ramend)
out sph,temp

sbi ddrd,4
sbi portd,4

ldi temp,$0f
out pind,temp

ldi temp,$21
out tccr1a,temp
ldi temp,$05
out tccr1b,temp
clr temp
out tcnt1h,temp
out tcnt1l,temp
again:

clr temp
out ocr1bh,temp
ldi temp,$00
out ocr1bl,temp

rcall delay

sw1:
sbic pinb,1
rjmp sw1

rcall two

sw2:
sbic pinb,2
rjmp sw2
rcall three

sw3:
sbic pinb,3
rjmp sw3
rcall four

rcall delay

rjmp again

two:
ldi temp,$20
out ocr1bl,temp
clr temp
out ocr1bh,temp
ret

three:
ldi temp,$90
out ocr1bl,temp
clr temp
out ocr1bh,temp
ret

four:
ldi temp,$f0
out ocr1bl,temp
clr temp
out ocr1bh,temp
ret

delay:
ldi r26,$10
d3:ldi r27,$ff
d2:ldi r28,$ff
d1:dec r28
brne d1
dec r27
brne d2
dec r26
brne d3
ret

On 10/1/07, casper_3399 wrote:
>
> dear all ,
>
> if any one know examples on speed control on dc motor using atmel
> series like at 8535.
> or the idea to how to programming and if there are c langauge example
>
> thanks
> shady
>
>
>

--

With Regards,
Bhanu Prakash V
[Non-text portions of this message have been removed]



(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )