'----------------------------------------------------------------------------------------- 'name : serio.bas 'programmed by : Claus Kuhnel 'date : 2008-02-06 'purpose : Serial IO Enhancement by Shift Registers 'micro : 2313 'tested with : V.1.11.8.8 'suited for demo : yes 'commercial addon needed : no '----------------------------------------------------------------------------------------- $regfile = "2313def.dat" ' AT90S2313 $crystal = 3690000 ' für STK500 Iclk Alias Portd.0 Ilatch Alias Portd.1 Idata Alias Portd.2 Reset Iclk ' ICLK = Lo Set Ilatch ' ILATCH = Hi Set Idata ' PullUp aktiv Config Pind.0 = Output ' Takt für HC165 Config Pind.1 = Output ' Latch für HC165 Config Pind.2 = Input ' Daten vom HC165 Oclk Alias Portb.7 ' Takt für HC595 Oclr Alias Portb.6 ' hier nicht verwendet Odata Alias Portb.5 ' Daten zum HC595 Olatch Alias Portb.4 ' Latch für HC595 Reset Oclk ' OCLK = Lo Reset Olatch ' OLATCH = Lo Reset Odata ' ODATA = Lo Config Portb = Output Dim X As Byte Dim Y As Byte Do Reset Ilatch ' Latch für HC165 Set Ilatch Shiftin Pind.2 , Pind.0 , X , 1 ' Lesen HC165 Y = Not X ' Bearbeitung Shiftout Pinb.5 , Pinb.7 , Y , 1 ' Schreiben HC595 Set Olatch Reset Olatch ' Latch für HC595 Waitms 10 ' 10 ms warten Loop End