Reply to comment

McGiver1's picture

Teraz pozostało zabrać się za

Teraz pozostało zabrać się za wyświetlenie pozostałych parametrów ,a szczególnie wykonać zmienianie godziny. Masz jakiś pomysł?
Pośrednio już wiem jak za to się wziąć:

$regfile = "attiny2313.dat"
$crystal = 8000000
 
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2
 
Config Scl = Portd.4
Config Sda = Portd.3
Config Pinb.0 = Input
 
Dim Godziny_bcd As Byte , Minuty_bcd As Byte , Sekundy_bcd As Byte
Dim Godziny As Byte , Minuty As Byte , Sekundy As Byte
Dim H As Byte , Hbcd As Byte
H = 19
Hbcd = Makebcd(h)
 
I2cstart
I2cwbyte 160
I2cwbyte 4
I2cwbyte Hbcd
I2cstop
 
Do
 
I2cstart
I2cwbyte 160
I2cwbyte 2
I2cstart
I2cwbyte 161
I2crbyte Sekundy_bcd , Ack
I2crbyte Minuty_bcd , Ack
I2crbyte Godziny_bcd , Nack
I2cstop
 
Sekundy = Makedec(sekundy_bcd)
Minuty = Makedec(minuty_bcd)
Godziny = Makedec(godziny_bcd)
 
Cls
Lcd "Czas " ; Godziny ; ":" ; Minuty ; ":" ; Sekundy
Waitms 900
 
Loop
End

Ale nie wiem jak to zrobię z przyciskami ,jakoś się to zrobi.
W tym programie zrobiłem ,by przy włączeniu do pcf-a wpisywał w godziny 19 ,zrobiłem to w ramach testu i działa zegar startuje od 19:0:0 :)
Pozdrawiam

Reply

  • You can use BBCode tags in the text. URLs will automatically be converted to links.
  • Use the special tag [adsense:format:slot] or [adsense:format:[group]:[channel][:slot]] or [adsense:block:location] to display Google AdSense ads.
  • You can enable syntax highlighting of source code with the following tags: [code], [blockcode], [c], [cpp], [java], [javascript], [php], [python], [qb].
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options