 |
www.elektronik.si Forum o elektrotehniki in računalništvu
|
Poglej prejšnjo temo :: Poglej naslednjo temo |
Avtor |
Sporočilo |
red_mamba Član


Pridružen-a: Ned 20 Feb 2005 17:56 Prispevkov: 1486 Aktiv.: 6.27 Kraj: Yogyakarta
|
Objavljeno: Pet Maj 23, 2008 10:49 pm Naslov sporočila: bascom tiny26 PWM |
|
|
Je že komu to uspelo spravit v pogon
Koda: |
Stop Watchdog
Dim Adc5 As Word
Dim Adc6 As Word
Dim Adc_cnt As Byte
Config Adc = Single , Prescaler = Auto , Reference = Internal
'Config Timer1 = Pwm , Prescale = 1 , Pwm = 8 , Compare A Pwm = Clear Down ' , Compare B Pwm = Clear Down
Tccr1a = &B01010011
Tccr1b = &B00000001
'Tccr1b = &B00000001
Config Portb = Output
Ocr1c = 0
Ocr1a = 0
Ocr1b = 0
Pllcsr = 0
Start Adc
Start Timer1
Do
Adc5 = Getadc(5)
Adc6 = Getadc(6)
Shift Adc5 , Right , 2
Shift Adc6 , Right , 2
Ocr1a= Adc5
Ocr1b= Adc6
Waitms 100
Loop
|
_________________ Bad things happen to good people all the time for no reason!
Blog |
|
Nazaj na vrh |
|
 |
Peter Član


Pridružen-a: Sre 30 Jun 2004 12:55 Prispevkov: 375 Aktiv.: 1.58 Kraj: Pod krvavcem nekje
|
Objavljeno: Sob Maj 24, 2008 8:21 pm Naslov sporočila: |
|
|
Koda: |
'-------------------------------------------------------------------------------
'lcb in adc
'-------------------------------------------------------------------------------
$regfile = "at26def.dat"
' default the internal osc runs at 1 MHz
$crystal = 1000000
Dim Utipala As Word , Channel As Byte , 'Enice As Word
Dim Oadc As Word , Pomozna As Word ,
'Config Lcd = 16 * 2
Config Adc = Single , Prescaler = Auto , Reference = Internal
'Config Lcdpin = Pin , Db4 = Portb.1 , Db5 = Portb.2 , Db6 = Portb.3 , Db7 = Portb.4 , E = Portb.5 , Rs = Portb.6
'Config Timer2 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 1
Tccr1a = &B01010011 'Manuelle Konfiguration von OC1a
Tccr1b = &B10000101 'Manuelle Konfiguration von OC1b
Ocr1c = 255 'Top Limmit
Config Pinb.0 = Output 'Port b.0 als Ausgang
Config Pinb.1 = Output 'Port b.1 als Ausgang
Config Pinb.2 = Output 'Port b.2 als Ausgang
Config Pinb.3 = Output 'Port b.3 als Ausgang
Ch1 Alias Ocr1a 'PWMA Channel
Ch0 Alias Ocr1b
Start Adc
Cls
Channel = 0
'now read A/D value from channel 0
Ch0 = 50 'PWMB Channel
Ch1 = 50
Do
Waitms 5
Oadc = Getadc(channel)
Utipala = Oadc / 11
Utipala = Utipala + 10
If Ch1 > 220 Then
Ch0 = 220
Ch1 = 220
End If
Ch0 = Utipala
Ch1 = Utipala
Pomozna = Utipala
Loop
End |
To je meni delovalo _________________ Vse se da pokvarit, le če se dovol časa ukvarjaš z njo!!! |
|
Nazaj na vrh |
|
 |
red_mamba Član


Pridružen-a: Ned 20 Feb 2005 17:56 Prispevkov: 1486 Aktiv.: 6.27 Kraj: Yogyakarta
|
Objavljeno: Ned Maj 25, 2008 11:20 am Naslov sporočila: |
|
|
bom preizkusil,
verjetno je problem v start timer1 pri meni, sedaj moram samo praktično preizkusit  _________________ Bad things happen to good people all the time for no reason!
Blog |
|
Nazaj na vrh |
|
 |
red_mamba Član


Pridružen-a: Ned 20 Feb 2005 17:56 Prispevkov: 1486 Aktiv.: 6.27 Kraj: Yogyakarta
|
Objavljeno: Tor Maj 27, 2008 11:23 am Naslov sporočila: |
|
|
no včeraj preizkusil, je bil problem v tem
Start timer1 ubistvu ugasne časovnik1.
Brez tega ukaza dela vse tako kot mora  _________________ Bad things happen to good people all the time for no reason!
Blog |
|
Nazaj na vrh |
|
 |
|
|
Ne, ne moreš dodajati novih tem v tem forumu Ne, ne moreš odgovarjati na teme v tem forumu Ne, ne moreš urejati svojih prispevkov v tem forumu Ne, ne moreš brisati svojih prispevkov v tem forumu Ne ne moreš glasovati v anketi v tem forumu Ne, ne moreš pripeti datotek v tem forumu Ne, ne moreš povleči datotek v tem forumu
|
Uptime: 494 dni
Powered by phpBB © 2001, 2005 phpBB Group
|