tcs230 icin yardim istiyorum bilgisi olan

Başlatan ens_azl, 17 Mayıs 2013, 02:49:32

ens_azl

mikro c ile tcs230 rgb renk sensörü için yardım istiyorum bilsi olan varsa yardım edebilir mi ben biraz birşeyler yazdım ama deger sürekli degişiyor

      PIC16F877A
      20.0 MHz
     mikroC
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;

sbit S2 at  RD7_bit;
sbit S3 at  RD6_bit;
sbit S0 at  RD5_bit;
sbit S1 at  RD4_bit;


unsigned int VAL;
char TXT[6];

void main() {


  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off

  TRISC0_bit=1;
   OPTION_REG.F5=1;
   TRISD=0X00;
    S0=1;
    S1=1;
    S2=0;
    S3=0;
     Delay_ms(1000);

  while(1)
  {
   Lcd_Cmd(_LCD_CLEAR);

    Lcd_Out(1, 1, " RENK SENS");
    TMR0=0;
    Delay_ms(1000);
    VAL=TMR0;
    WordToStr(VAL,TXT);
    Lcd_Out(2, 3,TXT);
     Delay_ms(2000);


  }

}