Re: sehr langsamer Zähler Kategorie: Programmierung Basic (von Jörg der Tüftler - 3.08.2006 8:35) | ||
Als Antwort auf sehr langsamer Zähler von Jörg der Tüftler - 16.07.2006 18:10 | ||
| ||
Hie Ist das richtige Programm das nicht Funktioniert '----- LED HELLIGKEIT ----- #define BRIGHT0 &H07 #define BRIGHT1 &H17 #define BRIGHT2 &H27 #define BRIGHT3 &H37 #define BRIGHT4 &H47 #define BRIGHT5 &H57 #define BRIGHT6 &H67 #define BRIGHT7 &H77 '-------------------------- '---- SYSTEM MEMORY ------- '-------------------------- Dim TAUSENDER As Byte Dim HUNDERTER As Byte Dim ZEHNER As Byte Dim EINER As Byte Dim COUNTER As Integer Dim Port_C6 As Byte Dim RDY As Byte '----------------------------------------------------- ' 7 SEGMENT DECODER '----------------------------------------------------- Sub DECODE (CODE As Byte) As Byte Select Case CODE Case 0 CODE=&H3F Case 1 CODE=&H06 Case 2 CODE=&H5B Case 3 CODE=&H4F Case 4 CODE=&H66 Case 5 CODE=&H6D Case 6 CODE=&H7D Case 7 CODE=&H07 Case 8 CODE=&H7F Case 9 CODE=&H6F End Case Return CODE End Sub '----------------------------------------------------- '-- IIC SEND BUFFER TO SAA1064 ---- '----------------------------------------------------- Sub SENDBUF(BRIGHT As Byte,DIGIT1 As Byte,DIGIT2 As Byte,DIGIT3 As Byte,DIGIT4 As Byte) I2C_Start() ' I2C Bus starten I2C_Write (&H76) ' Adresse des Bausteins I2C_Write (0) ' Startbit I2C_Write (BRIGHT) ' Controllbit I2C_Write (DIGIT1) ' erstes LED Segment I2C_Write (DIGIT2) ' zweites LED Segment I2C_Write (DIGIT3) ' drittes LED Segment I2C_Write (DIGIT4) ' viertes LED Segment I2C_Stop() ' I2C Stoppen AbsDelay(5) End Sub '---------------------------------------------------- ' SPLIT VALUE INTO DIGITS '---------------------------------------------------- Sub SPLIT_DIGITS(VALUE As Word) TAUSENDER=VALUE/1000 HUNDERTER=(VALUE-(TAUSENDER*1000))/100 ZEHNER=(VALUE-(TAUSENDER*1000)-(HUNDERTER*100))/10 EINER=VALUE-TAUSENDER*1000-HUNDERTER*100-ZEHNER*10 End Sub '------------------------------------------------------------------------------ ' Hauptprogramm ' Sub main() ' Variablendeklaration Dim Zeile(12) As Char I2C_Init(I2C_100kHz) ' I2C Bit Rate: 100 kHz LCD_Init() LCD_CursorPos(0) Zeile = "SAA1064" ' LCD Cursor positionieren LCD_WriteText(Zeile) ' String ausgeben LCD_CursorPos(&H40) Zeile = "Demo" ' LCD Cursor auf 2.Zeile positionieren LCD_WriteText(Zeile) ' String ausgeben '-------------------------------------------------------------- '------------------------Portabfrage 23------------------------ '-------------------------------------------------------------- Lab RDY Port_DataDirBit(23,0) Port_C6 = Port_ReadBit(23) SENDBUF(BRIGHT1,DECODE(EINER),DECODE(ZEHNER),DECODE(HUNDERTER),DECODE(TAUSENDER)) If Port_C6 = 1 Then COUNTER2() Else Goto RDY End If 'If Port_C6 < 0 Then 'Goto RDY 'End If If Port_C6 = 0 Then Goto RDY End If Goto RDY End Sub '---------------------COUNTER------------------------- Sub COUNTER2() For COUNTER = 0 To 9 SPLIT_DIGITS(COUNTER) SENDBUF(&H17,DECODE(EINER),DECODE(ZEHNER),DECODE(HUNDERTER),DECODE(TAUSENDER)) Next End Sub | ||
Antwort schreiben Antworten: |
Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum