Sciemniacz na 89c2051

Dec 19, 2003 4 Replies

Czy zbudowa³ kto¶ z was sciemniacz na tym procku? Mam zamiar zrobiæ co¶ takiego ale mam sporo problemów z napisaniem programu w bascomie do tego. Je¶li chodzi o szczegó³y to ma to by¶ sciamniacz na 220 do ¿arnika, a czas ¶ciemniania ma byæ ok 1h.



Znalaz³em ju¿ pare schematów do tego ale nie moge nigdzie dostaæ programu. By³o parte takich projektów ale na PWM co nie zdaje egzaminu przy moim projekcie. Czy mo¿e mi kto¶ pomóc???



Robi³em nawet dwa jeden w chacie dzia³a bez zarzutu 3 lata! Program pisa³em w Bascomie, a schemat - przerobi³em jeden z elektroniki praktycznej!

Co chcesz dok³adnie wiedziec? Wy¶lij na priva!

Marcin

Po pierwsze musisz z³apaæ moment przej¶cia napiêcia sieciowego przez zero. Mo¿na np. u¿yæ transformatora i mostka Graetza z którego bierzesz napiêcie 5 V - oczywi¶cie ¿adnych kondensatorów wyg³adzaj±cych. Napiêcie z mostka do³±czasz do jednego z pinów procesora i badasz stan tego portu. Je¶li jest niski to oznacza ¿e w³a¶nie napiêcie sieciowe przechodzi przez zero (dok³adniej rzecz bior±c jest stosunkowo niskie). Kiedy wykryjesz ten fakt, zaczynasz zmniejszanie zmiennej X od pewnej warto¶ci do zera - to daje ci opó¼nienie. Kiedy dojdziesz do zera w³±czasz triak. Oczywi¶cie im wiêksze X tym wiêksze opó¼nienie a tym samym mniejsza moc doprowadzona do obci±¿enia. Dobrze jest na pocz±tku zbadaæ jaka mo¿e byæ maksymalna warto¶æ X - czyli jaki czas up³ywa od jednego przej¶cia napiêcia sieci przez zero do nastêpnego.

AW

Dzieki za odpowiedzi ale ja wiem jak to ma wygl±daæ tylko nie umiem sobie z tym poradziæ w bascomie. Je¶li kto¶ bedzie taki uprzejmy i zamie¶ci tu prosty program który dostarczy do ¿arówki okre¶lon± moc (narazie bez ¿adnych rozja¶nieñ). Sam wiem ¿e pewnie to trzeba zrobiæ na timerach, ale tego nie umiem.

PS. Od strony sprzêtowej to zbudowa³em uk³ad z EP 6/2000 (bez wy¶wietlacza i klawiaturki) U¿ytkownik "AW" <pipek snipped-for-privacy@hotmail-kropka-com.cos.tam> napisa³ w wiadomo¶ci news:brvd45$5nd$ snipped-for-privacy@news.onet.pl...

U¿ytkownik "Lisu" snipped-for-privacy@tvsat364.lodz.pl> napisa³ w wiadomo¶ci news:bs1a3t$6jr$ snipped-for-privacy@kujawiak.man.lodz.pl...

To mój program do uk³adu regulatora o¶wietlenia z EP8/2001 :

--------------------------------------------------------------------------- ' Zdalnie sterowany regulator o¶wietlenia ' ' 28-04-2002 '---------------------------------------------------------------------------

-

$regfile = 89c2051.dat $crystal = 11059200

Dim New As Bit Dim Enable_rc5 As Bit Dim Toggle As Bit Dim Command As Byte , Subaddress As Byte Dim On_time As Byte Dim On_time_1 As Byte Dim On_time_save As Byte Dim Command_old As Byte Dim Command_count As Byte Dim Tmp As Byte Dim I As Byte Dim J As Byte Dim K As Byte Dim On_time_timer As Word Dim On_time_timer_tmp As Word

Const On_btn = 38 Const Off_btn = 12 Const Inc_btn_1 = 20 Const Dec_btn_1 = 21 Const Inc_btn_2 = 18 Const Dec_btn_2 = 19

Const Btn_repeat_time_1 = 14 Const Btn_repeat_time_2 = 14 'Int(btn_repeat_time_1 / 2)

Const Ms10 = &HDBFF Const Btn_beep = 2 Const Tempo = 2

Const Max_steps = 40 Const Time_min = 1656 Const Time = Int((9216 - Time_min) / Max_steps) Const Btn_mul = Max_steps / 10

Const Command_count_max = 4

Triac Alias P1.2 Btn_inc Alias P1.3 Buzzer Alias P1.5 Test_pin Alias P1.7

'---------------------------------------------------------------------------

---- ' '---------------------------------------------------------------------------

----

Set Triac

Reset Buzzer

Waitms 250

On_time = 0 New = 1 Command = 255 Command_old = 254 On_time_save = 7 Toggle = 0 On_time_1 = 20 Enable_rc5 = 0 I = 200 J = 50 K = 0

Set Buzzer

Config Timer0 = Timer , Gate = Internal , Mode = 1

Reset Tcon.0 Set Tcon.2

Reset Ip.0 Set Ip.1 Set Ip.2

On Int0 Receiverc5 On Timer0 Timer0_int On Int1 Int1_int

Enable Int0 Enable Timer0 Enable Int1

Enable Interrupts

'---------------------------------------------------------------------------

---- ' '---------------------------------------------------------------------------

----

Do

If New = 1 Then Disable Int0 New = 0

If Command = On_btn Then Reset Buzzer K = Btn_beep If On_time_1 > 0 Then On_time_save = On_time On_time = 0 Else On_time = On_time_save End If End If

If On_time_1 > 0 Then

If Command = Off_btn Then Reset Buzzer K = Btn_beep On_time_save = On_time On_time = 0 On_time_1 = 0 End If

If Command = Inc_btn_1 Then Reset Buzzer K = Btn_beep If On_time < Max_steps Then Incr On_time End If End If

If Command = Inc_btn_2 Then Reset Buzzer K = Btn_beep If On_time < Max_steps Then Incr On_time End If End If

If Command = Dec_btn_1 Then Reset Buzzer K = Btn_beep If On_time > 1 Then Decr On_time End If End If

If Command = Dec_btn_2 Then Reset Buzzer K = Btn_beep If On_time > 1 Then Decr On_time End If End If

End If

If Command = 0 Then Reset Buzzer K = Btn_beep On_time = Max_steps End If

If Command > 0 Then If Command < 10 Then Reset Buzzer K = Btn_beep On_time = Command * Btn_mul End If End If

Enable Int0 End If

If On_time_1 > 0 Then On_time_timer_tmp = Time_min

For Tmp = 1 To On_time_1 On_time_timer_tmp = On_time_timer_tmp + Time Next On_time_timer = 56319 + On_time_timer_tmp End If

Idle Loop

'---------------------------------------------------------------------------

---- ' '---------------------------------------------------------------------------

----

Receiverc5:

Getrc5(subaddress , Command)

If Command = Command_old And J = 0 Then Incr Command_count If Command_count = Command_count_max Then Command_count = 0 Enable_rc5 = 0 New = 0 J = Btn_repeat_time_1 End If

Else Command_count = 0 Enable_rc5 = 0 New = 0 End If

If Command = Command_old And Enable_rc5 = 1 Then Enable_rc5 = 0 New = 1 End If

Command_old = Command

Return

'---------------------------------------------------------------------------

---- ' '---------------------------------------------------------------------------

----

Timer0_int:

Stop Timer0

If On_time_1 > 0 Then Reset Triac

If Toggle = 0 Then Counter0 = Ms10 Start Timer0 Toggle = 1 Else Toggle = 0 End If

Set Triac End If

Return

'---------------------------------------------------------------------------

---- ' '---------------------------------------------------------------------------

----

Int1_int:

If On_time = Max_steps Then Reset Triac Else Set Triac Counter0 = On_time_timer Start Timer0 End If

Toggle = 0

If J > 0 Then Decr J If J = 0 Then Enable_rc5 = 1 End If End If

If K > 0 Then Decr K If K = 0 Then Set Buzzer End If End If

Decr I If I = 0 Then

If On_time > On_time_1 Then Incr On_time_1 End If

If On_time < On_time_1 Then Decr On_time_1 End If

I = Tempo End If

Return

'---------------------------------------------------------------------------

---- ' '---------------------------------------------------------------------------

----

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required