attiny i pwm

witam

mam problem z odpaleniem pwm pod bascomem

podczas przypisania PWM1A=100 wywala blad

wiec zrobilem wstawke w asm ale dalej cos nie tak

program ma czytac z adc0 wartosc z potencjometru i miekko sterowac silnikiem z pwm

$crystal = 10000000 $regfile = "at26def.dat" config adc = single , prescaler = auto config timer1 = pwm , pwm=8, compare a pwm = clear down , prescale =8

config pinb.1 = output config pina.0 = input

dim p as byte at &h60 dim d as byte dim v as word dim w as word

$asm push r16 ldi r16,$82 ' trcc1a com1a1 =1 com1a0 =0 pwm1a=1 ( bascom ustawia na 81h) out $30,r16 pop r16 $end asm

start adc

do v=getadc(0) v=v/2 w=511-v w=w/2

if w>p then '+ p=p+1 d=w-p end if

if w

Reply to
maciek
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.