Wyświetlacz musi być multipleksowany a raczej dane muszą być odświeżane/wysyłane co mniej wiecej 3ms (okolice 300Hz)
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- $regfile = "m328pdef.dat"
- $crystal = 8000000
- $hwstack = 64
- $swstack = 32
- $framesize = 128
- 'ROBOT DYN 6-DIGIT LED DISPLAY
- ' 6x50Hz=300Hz refresh rate ~3ms period
- Rck_pin Alias Portd.0 : Config Rck_pin = Output
- Clk_pin Alias Portd.1 : Config Clk_pin = Output
- Dio_pin Alias Portd.2 : Config Dio_pin = Output
- Dim Arr(2) As Byte , Mux As Byte
- Dim Muxw As Word At Arr(1) Overlay
- ' 321 654
- Arr(1) = &B01110111
- Arr(2) = &B10111111 '
- ' *GFEDCBA
- ' A
- ' _
- ' F|_|B
- ' E|_|C
- ' D
- '
- Do
- Incr Mux : If Mux > 6 Then Mux = 1
- Arr(1) = Lookup(mux , Displays)
- Arr(2) = Lookup(mux , Digits)
- Shiftout Dio_pin , Clk_pin , Muxw , 0
- Set Rck_pin : Reset Rck_pin
- Waitms 3
- Loop
- End
- Displays:
- ' dummy 1 2 3 4 5 6
- Data &B00000000 , &B00010000 , &B00100000 , &B01000000 , &B00000001 , &B00000010 , &B00000100
- Digits:
- ' 0 1 2 3 4 5
- Data &B11000000 , &B11111001 , &B10100100 , &B10110000 , &B10011001 , &B10010010
- ' 6 7 8 9 10 blank
- Data &B10000010 , &B11111000 , &B10000000 , &B10010000 , &B11111111