witam czy ktoś pomorze chodzi o zmianę programu nie jest to program napisany prze zemnie jest to projekt z edw chodzi o to czy da się go zmienić skrócić do sterowania dwóch silniczków krokowych ale na pilota rc5 oczywiście na attiny 2313 $crystal = 4000000 Config Portb = Output Config Portd = &B0000011 Portd = &B1111100 'Reset Portd.0 'Reset Portd.1 'Portb = 0 Dim C As Byte Config Timer0 = Timer , Prescale = 8 Enable Timer0 Enable Interrupts On Timer0 Kroki Start Timer0 Dim Czas As Word Dim D As Word Dim B As Byte Dim A As Byte Dim Pozwolenie1 As Byte 'Pozwolenie1 = 1 Dim Pozwolenie2 As Byte Dim Polkroki1 As Bit Dim Polkroki2 As Bit Dim Strona1 As Byte Dim Strona2 As Byte Dim D2 As Word Dim B2 As Byte Dim Czas2 As Word Dim C2 As Byte 'Czas = 15 'A = Pind Do Gosub Czasy 'nop If Pinb.2 = 0 Or Pinb.3 = 0 Then Gosub Klawiatura Loop Klawiatura: Waitms 10 A = Pind Shift A , Right , 2 If A < 31 Then If A = 29 Then Pozwolenie1 = 0 B = 0 Else If A > 16 Then Pozwolenie1 = 1 Else If A = 13 Then Pozwolenie2 = 0 B2 = 0 Else Pozwolenie2 = 1 End If End If End If If A = 30 Then B = B + 1 End If If A = 14 Then Incr B2 End If If A = 26 Then Decr B End If If A = 10 Then Decr B2 End If If A = 25 Then B = B + 10 End If If B > 52 Then B = 0 If A = 9 Then B2 = B2 + 10 End If If B2 > 52 Then B2 = 0 If A = 21 Then If B > 9 Then B = B - 10 End If If A = 5 Then If B2 > 9 Then B2 = B2 - 10 End If If A = 22 Then Toggle Polkroki1 End If If A = 6 Then Toggle Polkroki2 End If If A = 18 Then Strona1 = 1 If A = 17 Then Strona1 = 0 If A = 2 Then Strona2 = 1 If A = 1 Then Strona2 = 0 'Czas = Lookup(b , Prosta) 'Czas = Lookup(b , Prosta) A1: Gosub Czasy 'Czas = Lookup(b , Prosta) ' If Polkroki1 = 1 Then Czas = Czas / 2 ' ' Czas2 = Lookup(b2 , Prosta) ' If Polkroki2 = 1 Then Czas2 = Czas2 / 2 If Pind.2 = 0 Then Goto A1 End If If Pind.3 = 0 Then Goto A1 End If Waitms 70 End If Return Czasy: Czas = Lookup(b , Prosta) If Polkroki1 = 1 Then Czas = Czas / 2 Czas2 = Lookup(b2 , Prosta) If Polkroki2 = 1 Then Czas2 = Czas2 / 2 Return Kroki: Timer0 = 213 If Pozwolenie1 = 1 Then Incr D If D = Czas Or D > Czas Then D = 0 Incr C If Polkroki1 = 0 Then Incr C If C > 7 Then C = 0 Select Case C Case 0: If Strona1 = 0 Then Reset Portb.3 Set Portb.0 Else Reset Portb.2 Set Portb.0 End If Case 1: If Strona1 = 0 Then Set Portb.2 Else Set Portb.3 End If Case 2: If Strona1 = 0 Then Reset Portb.0 Set Portb.2 Else Reset Portb.0 Set Portb.3 End If Case 3: Set Portb.1 Case 4: If Strona1 = 0 Then Reset Portb.2 Set Portb.1 Else Reset Portb.3 Set Portb.1 End If Case 5 If Strona1 = 0 Then Set Portb.3 Else Set Portb.2 End If Case 6: If Strona1 = 0 Then Reset Portb.1 Set Portb.3 Else Reset Portb.1 Set Portb.2 End If Case 7 Set Portb.0 End Select End If Else Portb.0 = 0 Portb.1 = 0 Portb.2 = 0 Portb.3 = 0 End If If Pozwolenie2 = 1 Then Incr D2 If D2 = Czas2 Or D2 > Czas2 Then D2 = 0 Incr C2 If Polkroki2 = 0 Then Incr C2 If C2 > 7 Then C2 = 0 Select Case C2 Case 0: If Strona2 = 0 Then Reset Portb.7 Set Portb.4 Else Reset Portb.6 Set Portb.4 End If Case 1: If Strona2 = 0 Then Set Portb.6 Else Set Portb.7 End If Case 2: If Strona2 = 0 Then Reset Portb.4 Set Portb.6 Else Reset Portb.4 Set Portb.7 End If Case 3: Set Portb.5 Case 4: If Strona2 = 0 Then Reset Portb.6 Set Portb.5 Else Reset Portb.7 Set Portb.5 End If Case 5 If Strona2 = 0 Then Set Portb.7 Else Set Portb.6 End If Case 6: If Strona2 = 0 Then Reset Portb.5 Set Portb.7 Else Reset Portb.5 Set Portb.6 End If Case 7 Set Portb.4 End Select End If Else Portb.4 = 0 Portb.5 = 0 Portb.6 = 0 Portb.7 = 0 End If 'Loop 'End If Return Prosta: Data 6000% , 3000% , 1500% , 1000% , 750% , 600% , 500% , 428% , 375% , 333% , 300% Data 272% , 250% , 230% , 214% , 200% , 187% , 166% , 150% , 136% , 125% , 115% , 107% , 100% Data 91% , 83% , 77% , 71% , 65% , 60% , 55% , 50% , 46% , 43% , 39% , 35% , 33% , 30% , 27% , 25% Data 23% , 21% , 19% , 17% , 15% , 14% , 12% , 11% , 10% , 9% , 8% , 7% , 6%
|
|||








Re: Rc5
napisz lepiej co chcesz uzyskać i jak to ma działać zamiast wklejać kod, który nie ma nić wspólnego z rc5. jakie te silniki masz i jak szybko mają się kręcić? do czego to m służyć?
UWAGA! Możliwy jest zakup zaprogramowanych uC i zestawów elementów itp. do niektórych projektów. O dostępność proszę pytać via email. Konkretne oferty pojawiają się w cenniku.