Gast
#2012473
Hallo. Hat sich von euch schon mal jemand mit einem Zeilensensor der Fa Taos beschäftigt? Ich hab hier aktuell den Sensor TSL3301−LF, das ist ein Zeilensensor mit 102 Pixeln und integriertem A/D Wandler und serieller Datenschnittstelle. Ich betreibe den Sensor an einen PIC18F14K50 und sende die Daten via serieller Schnittstelle an den PC. Das funktioniert soweit auch ganz gut. Mein Problem ist folgendes: Beleuchte ich den Sensor sehr stark, geht er wie zu erwarten in Sättingung. Klebe ich den Sensor jedoch ab, so dass kein Licht auf den Sensor fällt, bekomme ich zufälliges wildes Gezappel zwischen 0 und 255. Sieht aus wie sehr sehr starkes Rauschen. Das gleiche auch bei einer abdunklung, also wenn der Sensor nicht übersteuert wird. Die Beleichtungszeit hat auch einen erkennbaren Einfluss, das "Rauschen" bleibt jedoch. Der Sensor ist relativ einfach aufgebaut, so dass ich nicht viele Einstellungsmöglichkeiten hab, daher bin ich ziemlich ratlos. Hat von euch jemand eine Idee? Gruß Markus MAIN: Reset_TWI(); //Reset Photosensor Start_Int(); //Start Integration Delay_Integration_Time(23); // 100µs Belichtungszeit abwarten Stopp_Int(); //Stopp Integration and start sample results Read_Pixels(); *************************** void Reset_TWI(void) { SDO = 0; // Clear SDO Pulse_SCK(30); // Pulse SCLK 30 times // Interface Reset SDO = 1; // Set SDO Pulse_SCK(10); // Pulse SCLK 10 times Send_Byte(0x1B); // Send RESET Command Pulse_SCK(5); // Pulse SCLK 5 times // Register Initialisation Send_Byte(0x5F); // Write to Mode Register Send_Byte(0x00); // Clear Mode Register Send_Byte(0x40); // Offset 34 left pixels Send_Byte(0x00); // Offset = 0 Send_Byte(0x41); // Gain 34 left pixels Send_Byte(0x00); // Gain = 1 Send_Byte(0x42); // Offset middle 34 pixels Send_Byte(0x00); // Offset = 0 Send_Byte(0x43); // Gain middle 34 pixels Send_Byte(0x00); // Gain = 1 Send_Byte(0x44); // Offset right 34 pixels Send_Byte(0x00); // Offset = 0 Send_Byte(0x45); // Gain right 34 pixels Send_Byte(0x00); // Gain = 1 }//end Reset_TWI void Start_Int(void) { Send_Byte(0x08); // Start Integration Pulse_SCK(22); // Pulse SCK 22x }//end Start_Int void Stopp_Int(void) { Send_Byte(0x10); // stopp Integration Pulse_SCK(5); // Pulse SCK 5x }//end Stopp_Int void Read_Pixels(void) { unsigned int Pixels; unsigned char Buffer = 0; Send_Byte(0x02); // Start reading pixels do // wait until AD conversion is finished { Pulse_SCK(1); }while(SDI == 1); for(Pixels = 0; Pixels <102; Pixels++) { // reading value and send to PC Buffer = 0; Buffer = ReceiveValue(); // get value of pixel while(!TXSTAbits.TRMT); // wait until Transmitter is ready TXREG = Buffer; // send value } }//end void Read_Pixels unsigned char ReceiveValue(void) { unsigned int BitCount; unsigned char PixelValue; PixelValue = 0x00; for(BitCount = 8; BitCount > 0; BitCount--) { Pulse_SCK(1); // get next bit of sensor PixelValue = PixelValue << 1; // shift pixel value left // store pixel value in variable if(SDI == 1) { PixelValue |= 0x01; } else { PixelValue &= 0xFE; } } Pulse_SCK(2); // wait for Stopp and start bit return(PixelValue); }//end ReceiveValue