[ Dodano: 2009-03-12, 12:21 ]
powracam do pierwotnej koncepcji...
- kontroler attiny2313;
- PortB do sterowania segmentami;
- CD4028 do sterowania siatkami;
będzie prosto i łatwo a i tak zostają mi 4 wolne porty do ustawień i innych rzeczy (wolny ponad 1kB pamięci FLASH). tak więc Panie Kulpina mogę wcisnąć termometr
jeszcze zamiast sterować segmentami bezpośrednio, mogę wrzucić CD4055 i sterować wszystkim jednym portem
[ Dodano: 2009-03-12, 12:52 ]
P.S.
Dzięki za pomoc w programowaniu...
[ Dodano: 2009-03-12, 13:20 ]
na podstawie "pewnej" książki napisałem takie coś:
Kod: Zaznacz cały
Dim sekjed as byte , sekdzies as byte
Dim minjed as byte , mindzies as byte
Dim godjed as byte , goddzies as byte
Dim mplex as byte , ep1 as byte : ep2 as byte
const kreska = 11
A3 alias PortD.6
A2 alias PortD.5
A1 alias PortD.4
A0 alias PortD.3
Config PortB = &B11111111 : PortB = &B11111111
Config PortD = &B1111000 : PortD = &B1111111
Config Timer0 = timer , prescale = 64
Config Timer1 = timer , prescale = 64
Enable Interrupts : Enable Timer0 : Enable Timer1
Stop Ac
On timer0 fourms : On timer1 secs
sekjed = 0 : sekdzies = 0 : minjed = 0 : mindzies = 0 : godjed = 0 : goddzies = 0
Do : Loop : End
fourms:
Decr ep1
If Pind.1 = 0 and Pind.0 = 1 then
If ep1 = 0 then
ep1 = ep2 : incr minjed : sekjed = 0 : sekdzies = 0
ep2 = ep2 - 8
If ep2 < 8 then ep2 = 8
end if : end if
If Pind,0 and Pind.1 = 1 then
If ep1 = 0 then
ep1 = ep2 : incr godjed
ep2 = ep2 - 8
If ep2 < 12 then ep2 = 12
end if : else
If ep1 = 0 then
ep1 = 4 : ep2 = 100
end if : end if
Incr mplex
If mplex = 8 then mplex = 0 : PortD = &B1111111
Select case mplex
Case 0:
PortB = Lookup (sekjed , Tablica)
A3 = 0 : A2 = 1 : A1 = 1 : A0 = 1
Case 1:
PortB = Lookup (sekdzies , Tablica)
A3 = 0 : A2 = 1 : A1 = 1 : A0 = 0
Case 2:
PortB = Lookup (kreska , Tablica)
A3 = 0 : A2 = 1 : A1 = 0 : A0 = 1
Case3:
PortB = Lookup (minjed , Tablica)
A3 = 0 : A2 = 1 : A1 = 0 : A0 = 0
Case 4:
PortB = Lookup (mindzies , Tablica)
A3 = 0 : A2 = 0 : A1 = 1 : A0 = 1
Case 5:
PortB = Lookup (kreska , Tablica)
A3 = 0 : A2 = 0 : A1 = 1 : A0 = 0
Case 6:
PortB = Lookup (godjed , Tablica)
A3 = 0 : A2 = 0 : A1 = 0 : A0 = 1
Case 7:
PortB = Lookup (goddzies , Tablica)
A3 = 0 : A2 = 0 : A1 = 0 : A0 = 0
End select : retur
secs:
Timer1 = 3036
Incr sekjed
If sekjed = 10 then
sekjed = 0
incr sekdzies
if sekdzies = 6 then
sekdzies = 0
incr minjed
if minjed = 10 then
minjed = 0
incr mindzies
if mindzies = 6 then
mindzies = 0
incr godjed
if godjed = 10 then
godjed = 0
incr goddzies
end if : end if : end if : end if : end if
If goddzies = 2 and godjed = 4 then
goddzies = 0 : godjed = 0
end if : return
Tablica:
Data 192 , 249 , 164 , 176 , 153, 146 , 130 , 248 , 128 , 144 , 191 czy "to" będzie działać?