Device 16F876A Xtal 20 Dim Daten As Word Dim Daten2 As Byte Dim NewByte As Bit Symbol CS = PORTC.0 Symbol SDI = PORTC.4 Symbol SDO = PORTC.5 Symbol SCL = PORTC.3 Symbol nFFS = PORTC.2 Symbol FFIT = PORTC.1 Symbol PS0 = OPTION_REG.0 ' Prescaler Rate Select bits Symbol PS1 = OPTION_REG.1 ' Prescaler Rate Select bits Symbol PS2 = OPTION_REG.2 ' Prescaler Rate Select bits Symbol PSA = OPTION_REG.3 ' Prescaler Assignment bit Symbol T0SE = OPTION_REG.4 ' TMR0 Source Edge Select bit Symbol T0CS = OPTION_REG.5 ' TMR0 Clock Source Select bit Symbol INTEDG = OPTION_REG.6 ' Interrupt Edge Select bit Symbol NOT_RAPU = OPTION_REG.7 ' PORTA Pull-up Enable bit PS0 = 1 PS1 = 1 PS2 = 1 PSA = 0 T0CS = 0 INTEDG = 1 Symbol RAIF = INTCON.0 ' PORTA Change Interrupt Flag Symbol INTF = INTCON.1 ' RA2/INT External Interrupt Flag Symbol T0IF = INTCON.2 ' TMR0 Overflow Interrupt Flag Symbol RAIE = INTCON.3 ' PORTA Change Interrupt Enable Symbol INTE = INTCON.4 ' RA2/INT External Interrupt Enable Symbol T0IE = INTCON.5 ' TMR0 Overflow Interrupt Enable Symbol PEIE = INTCON.6 ' Peripheral Interrupt Enable Symbol GIE = INTCON.7 ' Global Interrupt Enable INTCON = %00010000 TRISC = %00010010 DelayMS 500 Low CS Daten = $0000 : GoSub configs Daten = $8058 : GoSub configs Daten = $82d9 : GoSub configs Daten = $a680 : GoSub configs Daten = $c67f : GoSub configs Daten = $95a1 : GoSub configs Daten = $c2ac : GoSub configs Daten = $ca80 : GoSub configs Daten = $ca83 : GoSub configs Daten = $c4f7 : GoSub configs Daten = $e000 : GoSub configs Daten = $c800 : GoSub configs High CS On_Interrupt GoTo Auslesen Main: Nop Nop Nop Nop ' Hier werden die Daten ausgewertet und verarbeitet GoTo Main 'INT_SUB_START Auslesen: Context Save CS = 1 nFFS = 0 SHIn SDI, SCL, MsbPre, [Daten2\8] CS = 1 nFFS = 1 Daten = $ca81 : GoSub configs Daten = $ca83 : GoSub configs INTF = 0 Context Restore 'INT_SUB_END configs: CS=0 SDO = Daten.15 'Die Configs werden "per Hand" übertragen -> schnellen als SHOut SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.14 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.13 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.12 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.11 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.10 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.9 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.8 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.7 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.6 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.5 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.4 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.3 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.2 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.1 SCL = 1:Nop:Nop:Nop:SCL = 0 SDO = Daten.0 SCL = 1:Nop:Nop:Nop:SCL = 0 CS=1 Return