Elektronik ve Teknoloji Merkezi Elektrotekno.com
Elektronik ve Teknoloji Merkezi




Click here to go to the original topic

Elektrotekno.com Ana Sayfa Kayan yazı ve matrix led devreleri (led message projects)
Yazar Mesaj
zerog26
Tarih: 22.08.2007, 10:29 Mesaj konusu: pc kontrollü 80 sütun kayan yazı_yardım

arkadaşlar yapmış olduğum 80 sütu kayan yazı devresi pc den hyper terminel ile kontrolediliyo. re1 butonuna basılınca kayan yazı siliniyo ve yerminal ekranına kaç karakter yazısı beliriyo karakter sayısı giriliyo ondan sonra karakterleri girin diye bi yazı çıkıyo girince kaymaya başlıyo. buraya kadar sorun yok .... yazılım bana aiti değil yazılıma göre devre şemasını çıkardım sadece bide biligisayarla haberleşmesi için komutlar girilmesine rağmen haberleşmiyodu onu düzelttim ama program c ile yazılmış bende c den pek anlamıyom anladığım kadarını yaptım ..... şidi karakter sorunum var 99 karakterden fazla almıyo bunu nasıl yükseltecez eeprom ekleyeyim dedim ama kodlarını bilmediğim için olmadı.

sizlerden ricam: bu devreye biraz kafa yorarak bunun karakter hafızasını yükseltip terminal ekranına gelen kaç karakter yazısını da kaldırıp onun yerine sadece metni girip entere basınca kayan bi sistem ondan sonrada tabi saat ve derece eklemek kalıyo .... ilgilenen arkadaşlara şimdiden teşekkür......

http://img354.imageshack.us/my.php?image=adszcc5.jpg


dosyalar burada:::::::::http://rapidshare.com/files/50493776/kay_yazi.rar


[/img] Kod: //if defined(__pcm__)
#include <16f877a.h>
#fuses hs,nowdt,noput,noprotect,nobrownout,nolvp
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=pın_c6, rcv=pın_c7,restart_wdt, errors)

#define pın_st_cp      pın_c2  // rclk ----> pin 12 st_cp
#define pın_sh_cp      pın_c3  // srclk ---> pin 11 sh_cp
#define pın_ser_ın     pın_c5  // ser -----> pin 14

/*#define number_of_74595 10
#endıf
//#include <74595_v02.c>*/

#byte port_a=5
#byte port_b=6
#byte port_c=7
#byte port_d=8

#use fast_io(b)
#use fast_io(c)
#use fast_io(d)

long s1_char_size=41;
char s1[79];
long i;

//***********************sutunlara bağlı hc595**********************************
#define clock      pın_b0  // rclk ----> pin 12 st_cp
#define latch      pın_b2  // srclk ---> pin 11 sh_cp
#define data       pın_b1  // ser -----> pin 14

void hc595_out_satir(unsigned char send_data)
{
   unsigned char bit_mask;

   for (bit_mask=1; bit_mask ;bit_mask <<=1)
   {
      // on an avr you can set the bit directly and i'd use
       //"data = (send_data & bit_mask);"

      //else use this if/else ....
      if((send_data & bit_mask))
        output_high(data);

      else
        output_low(data);

      output_high(clock);
      delay_us(1);
      output_low(clock);
   }

   output_high(latch);
   delay_us(1);
   output_low(latch);
}
//******************************************************************************

void get_line1(void)
{
  for(i=0; i<s1_char_size; i++)
  {
    if(kbhit())
    {
      s1[i]=getc();
      delay_cycles(2);
      printf("%c",s1[i]);
      delay_us(1);
    }
    else
      i -= 1;
  }
}  // end of void get_line1()

char  const msg_default[] = "<<----------edit by mehmet bas---------->> ";

char  const ascii1[32][5] = {
   {0,0,0,0,0}                  //   0
   {0,0,95,0,0}         //   {0,95,0,0,0,0}
   //   1
   {0,7,0,7,0}          // {0, 7,0,7,0,0}
 //   2
   {20,127,20,127,20}          //   3
   {36, 42, 127, 42, 18}       //   4
   {39, 21, 107, 84, 114}      //   5
   {54, 73, 86, 32, 80}        //   6
   {0, 11, 7,0,0}      // {0, 11, 7,0,0,0}
//   7
   {0, 28, 34, 65,0}    // {0, 28, 34, 65,0,0}
 //   8
   {0, 65, 34, 28,0}    // {0, 65, 34, 28,0,0}
 //   9
   {42, 28, 127, 28, 42}       //   10
   {8, 8, 62, 8, 8}            //   11
   {0, 88, 56, 0,0}      // {0, 88, 56,0,0,0}
  //   12
   {8,8,8,8,8}                 //   13
   {0, 96, 96, 0,0}      // {0, 96, 96,0,0,0}
  //   14
   {32, 16, 8, 4, 2}           //   15
   {62, 81, 73, 69, 62}        //   16
   {0, 66, 127, 64,0}       // {0,66, 127, 64,0,0}
     //   17
   {114, 73, 73, 73, 70}       //   18
   {34, 65, 73, 73, 54}        //   19
   {24, 20, 18, 127, 16}       //   20
   {39, 69, 69, 69, 57}        //   21
   {60, 74, 73, 73, 48}        //   22
   {1, 113, 9, 5, 3}           //   23
   {54, 73, 73, 73, 54}        //   24
   {6, 73, 73, 41, 30}         //   25
   {0, 54,54,0,0}         // {0, 54, 54,0,0,0}
   //   26
   {0, 91, 59, 0,0}         // {0, 91, 59,0,0,0}     // 27
   {8, 20, 34, 65,0}           //   28
   {20, 20, 20, 20, 20}        //   29
   {65, 34, 20, 8,0}           //   30
   {2, 1, 81, 9, 6}            //   31
   };

char  const ascii2[32][5] = {
{50, 73, 121, 65, 62}          //      0
{124, 18, 17, 18, 124}         //      1   a
{65, 127, 73, 73, 54}          //      2   b
{62, 65, 65, 65, 34}           //      3   c
{65, 127, 65, 65, 62}          //      4   d
{127, 73, 73, 65, 65 }         //      5   e
{127, 9, 9, 1, 1}              //      6
{62, 65, 73, 73, 58}           //      7
{127, 8, 8, 8, 127}            //      8
{0, 65, 127, 65, 0}       // {0, 65, 127, 65,0,0}
        //      9
{32, 64, 65, 63, 1}            //      10
{127, 8, 20, 34, 65}           //      11
{127, 64, 64, 64, 64}          //      12
{127, 2, 12, 2, 127}           //      13
{127, 2,  4, 8, 127}           //      14
{62, 65, 65, 65, 62}           //      15
{127, 9, 9, 9, 6}              //      16
{62, 65, 81, 33, 94}           //      17
{127, 9, 25, 41, 70}           //      18
{38, 73, 73, 73, 50}           //      19
{1,1,127, 1, 1}                //      20
{63, 64, 64, 64, 63}           //      21
{7, 24, 96, 24, 7}             //      22
{127, 32, 24, 32, 127}         //      23
{99, 20, 8, 20, 99}            //      24
{3, 4, 120, 4, 3}              //      25
{97, 81, 73, 69, 67}           //      26
{0, 127, 65, 65,0}          // {0, 127, 65, 65,0,0}
          //      27
{2, 4, 8, 16, 32}              //      28
{0, 65, 65, 127,0}          // {0, 65, 65, 127,0,0}
          //      29
{4, 2, 1, 2, 4}                //      30
{64, 64, 64, 64, 64}           //      31
};

char  const ascii3[31][5] = {    // 0 -- 30 == 31 elements
   {0, 0, 7, 11,0}        // {0, 7, 11,0,0,0}
  //   0
   {32, 84, 84, 84, 56}     //   1
   {127, 40, 68, 68, 56}    //   2
   {56, 68, 68, 68,0}     //   3
   {56, 68, 68, 40, 127}     //   4
   {56, 84, 84, 84, 24}     //   5
   {8, 126, 9, 9, 2}     //   6
   {8, 84, 84, 84, 60}     //   7
   {127, 8, 4, 4, 120}     //   8
   {0, 68, 125, 64,0}      // {0, 68, 125, 64,0,0}
//   9
   {32, 64, 68, 61,0}     //   10
   {127, 16, 40, 68,0}     //   11
   {0, 65, 127, 64, 0}      // {0, 65, 127, 64,0,0}
//   12
   {124, 4, 120, 4, 120}     //   13
   {124, 8, 4, 4, 120}     //   14
   {56, 68, 68, 68, 56}     //   15
   {124, 20, 20, 20, 8}     //   16
   {8, 20, 20, 20, 124}     //   17
   {124, 8, 4, 4, 8}     //   18
   {72, 84, 84, 84, 36}     //   19
   {4, 63, 68, 68,0}     //   20
   {60, 64, 64, 32, 124}     //   21
   {28, 32, 64, 32, 28}     //   22
   {60, 64, 48, 64, 60}     //   23
   {68, 40, 16, 40, 68}     //   24
   {12,80, 80, 80, 60}     //   25
   {68, 100, 84, 76, 68}     //   26
   {0, 8, 54, 65,0}           // {0, 8, 54, 65,0,0}
//   27
   {0,0,119,0,0}             // {0, 119,0,0,0,0}     // 28
   {0, 65, 54, 8,0}           // {0, 65, 54, 8,0,0}
//   29
   {2,1,2,4,2}     //   30
};

void main(void)
{
  int char_index;
  int col_index;
  int x = 0;
  long msd, lsd;
  int delaycount;
  int16 startposition;

  set_tris_b(0);    //set portb to outputs
  set_tris_c(0x90); //set portc to outputs, c7 to input
  set_tris_d(0);
  hc595_out_satir(0);
  //port_b = 0;
  output_c(0);       //zero port c
  startposition = 0;

  for(i=0; i<79; i++)
    s1[i] =1;

  for(i=0; i<sizeof(msg_default); i++)
    s1[i] = msg_default[i];

  delay_ms(100);
  do
  {
    if(!input(pın_e1)) //if re1==low (pressed)
    {
       
       
       
      do
      {
        delay_cycles(2);
        printf("\f\r\n");             
        printf("\f\r\n\n kac karakter .(0--99):");
        msd=getc();
        delay_cycles(2);
        printf("%c",msd);
        delay_us(1);
      }while(!isamoung(msd,"0123456789"));
      do
      {
        lsd=getc();
        delay_cycles(2);
        printf("%c",lsd);
        delay_us(1);
      }while(!isamoung(lsd,"0123456789"));


      s1_char_size = 10*(msd-48) + (lsd-48);
      delay_cycles(2);
      printf("\r\n\n %lu karakter gırınız .: ",s1_char_size);
      get_line1();      // acquire 16 char.
    }  // end of ınput(pın_e1)

    // the delay count controls how fast the message scrolls
    delaycount=2;
    while (delaycount)
    {
      // this will be the index into our character
      col_index = startposition % 6;
      // this will be the index into our display msg array
      char_index = startposition / 6;

      // make sure that our index doesn't exceed our array size
      if (char_index >= sizeof(s1))
      {
        startposition = 0;
        char_index = 0;
        col_index = 0;
      }
      // grab the first char
      x = s1[char_index];

      // 74hc595 ler suruluyor
      output_high(pın_sh_cp);
      output_high(pın_st_cp);
      output_high(pın_ser_ın);
      output_low(pın_sh_cp);
      delay_us(1);
      output_high(pın_sh_cp);
      output_low(pın_ser_ın);

      for (i=0;i<80;i++) // we've 80 columns to
      {

        output_low(pın_st_cp);
        delay_us(200);
        output_high(pın_st_cp);
        delay_us(1);
        output_low(pın_sh_cp);
        delay_us(1);
        output_high(pın_sh_cp);

        if (col_index == 5)
        {
          col_index = 0;
          char_index++;
          if (char_index >= sizeof(s1))
            char_index = 0;
          x = s1[char_index];
        }
        else
        {
          if ( x < 32)
            hc595_out_satir(0);
          else if( x < 64)
            hc595_out_satir(ascii1[x-32][col_index]);
          else if( x < 96 )
            hc595_out_satir(ascii2[x-64][col_index]);
          else if( x < 128)
            hc595_out_satir(ascii3[x-96][col_index]);

          col_index++;
        }
        delay_us(120);
        hc595_out_satir(0);
      }
      delaycount--;
    }
    startposition++;
  } while(1);
}


onurbilke
Tarih: 30.08.2007, 03:55 Mesaj konusu:

Arkadaşım Foruma Ekledim Benim Yazıya Bak 5000 den fazla karakter hafızalı yardımcı olur sana
Elektrotekno.com Ana Sayfa Kayan yazı ve matrix led devreleri (led message projects)
1. sayfa (Toplam 1 sayfa)

pc kontrollü 80 sütun kayan yazı_yardım

Gizlilik Politikası

PLC programming