Im Datebblatt steht jedenfalls
Zitat von
Datenblatt
Frame Rate: 10 fps - 30 fps
Hier dann nochmal mein derzeitiges Programm (liefert auch 16384 Pixel):
Code:
'Init:
$regfile = "m8515.dat" 'ATmega8515-Deklarationen
$crystal = 3686400 'Quarz: 4 MHz
$baud = 115200
Declare Sub Register_laden(addr As Byte , Wert As Byte)
'Variablen:
Dim Regaddr(8) As Byte
Dim Regwert(8) As Byte
Dim Bild(16384) As Xram Byte
Dim Z As Word
Dim I As Byte
'Register festlegen:
Regaddr(1) = 1
Regaddr(2) = 2
Regaddr(3) = 3
Regaddr(4) = 4
Regaddr(5) = 5
Regaddr(6) = 6
Regaddr(7) = 7
Regaddr(8) = 0
'Register für Positive Image
Regwert(1) = 0
Regwert(2) = 0
Regwert(3) = 60
Regwert(4) = 3
Regwert(5) = 0
Regwert(6) = 1
Regwert(7) = 4
Regwert(8) = 128
'Register für 2D Ext.
' Regwert(1) = &B11100000
' Regwert(2) = 0
' Regwert(3) = 60
' Regwert(4) = 3
' Regwert(5) = 0
' Regwert(6) = 1
' Regwert(7) = 128
' Regwert(8) = 0
Config Scl = Porte.0
Config Sda = Porte.2
I2cinit
I2cstart
I2cwbyte &B10010000
I2cwbyte &B00000000
I2cstop
Xckpin Alias Portb.0
Resetpin Alias Portb.1
Loadpin Alias Portb.2
Sinpin Alias Portb.3
Startpin Alias Portb.4
Readpin Alias Pind.5
'Pins festlegen:
Config Portb.0 = Output 'XCK
Config Portb.1 = Output 'Reset
Config Portb.3 = Output 'Sin
Config Portd.5 = Input 'Read
Config Portb.2 = Output 'Load
Config Portb.4 = Output 'Start
'Pins initialisieren:
Resetpin = 1 'Reset High
Xckpin = 1 'XCK High
Loadpin = 0 'Load Low
Startpin = 0 'Start Low
'Reset:
Waitus 1
Xckpin = 0
Waitus 1
Resetpin = 0
Waitus 1
Xckpin = 1
Waitus 1
Resetpin = 1
Waitus 1
Xckpin = 0
Waitus 1
'Register Laden
Call Register_laden(regaddr(1) , Regwert(1))
Call Register_laden(regaddr(2) , Regwert(2))
Call Register_laden(regaddr(3) , Regwert(3))
Call Register_laden(regaddr(4) , Regwert(4))
Call Register_laden(regaddr(5) , Regwert(5))
Call Register_laden(regaddr(6) , Regwert(6))
Call Register_laden(regaddr(7) , Regwert(7))
Call Register_laden(regaddr(8) , Regwert(8))
'Start:
Startpin = 1
Waitus 1
Xckpin = 1
Waitus 1
Startpin = 0
Waitus 1
Xckpin = 0
Waitus 1
Do
'Warten Bis Bild Fertig:
While Readpin = 0
Xckpin = 1
Waitus 1
Xckpin = 0
Waitus 1
Wend
'Bild einlesen:
Z = 0
I2cstart
I2cwbyte &B10010001
I2crbyte I , 8
While Readpin = 1
Xckpin = 1
Waitus 1
Incr Z
I2crbyte I , 8
Bild(z) = I
Xckpin = 0
Waitus 1
Wend
I2crbyte I , 9
Incr Z
Bild(z) = I
I2cstop
'Bild über die ser. Schnittstelle ausgeben:
For Z = 1 To 16384
Printbin Bild(z);
Next
Loop
End 'end program
'Register laden:
Sub Register_laden(addr As Byte , Wert As Byte)
'Registeraddr übertragen:
For I = 2 To 0 Step -1
Sinpin = Addr.i
Waitus 1
Xckpin = 1
Waitus 1
Xckpin = 0
Waitus 1
Next
'Registerwert übertragen:
For I = 7 To 0 Step -1
Sinpin = Wert.i
Waitus 1
Xckpin = 1
Waitus 1
If I = 0 Then
Loadpin = 1
End If
Waitus 1
Xckpin = 0
Waitus 1
Loadpin = 0
Next
Sinpin = 0
End Sub
Lesezeichen