Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $regfile = "m8def.dat" 'mikrokontroler, z którego korzystamy (biblioteka)
- $crystal = 4000000 'taktowanie (czestotliwosc) mikrokontrolera
- $hwstack = 40
- $swstack = 16
- $framesize = 32
- $sim
- Config Pinb.1 = Input 'Konfiguracja PINB.1 jako wejście
- Config Portb = Output 'Konfiguracja portu B jako wyjście
- Config Portd = Output 'Konfiguracja portu D jako wejście
- Do 'Poczatek petli nieskonczonej
- If Pinb.1 = 1 Then 'Warunkek jesli spelniony (czyli PINB.1 = 1) wtedy wykonaj następującą część kodu
- Portd.0 = 1 'Kolejne 23 linie kodu odpowiadaja za sterowanie wyjsciami na Porcie D (zapalanie i wygaszanie diod z przerwami 1 sekundowymi)
- Wait 1
- Portd.1 = 1
- Wait 1
- Portd.2 = 1
- Wait 1
- Portd.3 = 1
- Wait 1
- Portd.4 = 1
- Wait 1
- Portd.5 = 1
- Wait 1
- Portd.6 = 1
- Wait 1
- Portd.7 = 1
- Wait 1
- Portd.0 = 0
- Portd.1 = 0
- Portd.2 = 0
- Portd.3 = 0
- Portd.4 = 0
- Portd.5 = 0
- Portd.6 = 0
- Portd.7 = 0
- Elseif Pinb.1 = 0 Then 'Jezeli 1 warunek nie zostal spelniony wtedy wykonaj 2 warunek (PINB.1 = 0)
- Portb.7 = 1 'Kolejne 23 linie kodu odpowiadaja za sterowanie wyjsciami na porcie B (zapalanie i wygaszanie diod z przerwami 1 sekundowymi, kolejnosc odwrotna niz w warunku 1)
- Wait 1
- Portb.6 = 1
- Wait 1
- Portb.5 = 1
- Wait 1
- Portb.4 = 1
- Wait 1
- Portb.3 = 1
- Wait 1
- Portb.2 = 1
- Wait 1
- Portb.1 = 1
- Wait 1
- Portb.0 = 1
- Wait 1
- Portb.7 = 0
- Portb.6 = 0
- Portb.5 = 0
- Portb.4 = 0
- Portb.3 = 0
- Portb.2 = 0
- Portb.1 = 0
- Portb.0 = 0
- End If 'Koniec warunku
- 'Koniec petli
- Loop
- End 'Koniec programu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement