Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I need pwm according to the encoder 1024 pule speed

Status
Not open for further replies.

honey361

Newbie level 4
Joined
Apr 22, 2009
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pakistan
Activity points
1,351
PWM OUT

Dear All,
Can any one advise the below code where is wrong because it is not working with encoder, I need pwm according to the encoder 1024 pule speed, maximum encoder shaft speed is 1400 rpm, mcu is AVR Atmega8L amd software is Bascom-Avr,

Thanks in Advance

$regfile = "m8def.dat"
$crystal = 1000000

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim Yard As Word
Dim Cb As Byte
Dim B As Bit
Dim Y As Word
Config Timer0 = Counter , Edge = Rising

Stop Timer0


Tccr1a = &B10100011
Tccr1b = &B00000001

Config Portb = Output
Config Portd.0 = Input
Config Portd.1 = Input
Config Debounce = 10

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Do
For Cb = 1 To 10 Step 1
Debounce Pind.0 , 1 , Int0_isr , Sub
Debounce Pind.1 , 1 , Int1_isr , Sub

Start Timer0
Waitms 100
Stop Timer0
Yard = Yard + Counter0 : Counter0 = 0
Next

Pwm1a = Yard
Yard = 0 : Cb = 0
Loop
End
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top