CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

scrolling message board but animated problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nemo41



Joined: 29 Jun 2010
Posts: 1

View user's profile Send private message MSN Messenger

scrolling message board but animated problem
PostPosted: Tue Jun 29, 2010 1:12 pm     Reply with quote

I sending working source code. My problem is to animate. Its up to down scroll message. I cant do it. Maybe write anybody?

Source code:
Code:

#include <18F452.h>
#include <string.h>
#FUSES NOWDT,WDT128,HS,NOPROTECT,NOOSCSEN,NOBROWNOUT,NOPUT,STVREN,NODEBUG,NOLVP,NOWRT,NOWRTD,NOWRTB,NOWRTC,NOCPD,NOCPB,NOEBTR,NOEBTRB
#use delay(clock=20000000)
//#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
//#include <SHT75.c>
//#include <DS1302.c>

#define clock      pin_a0  //
#define latch      pin_a1  //
#define ds1        pin_a2  //

#use fast_io(a)
#use fast_io(b)
#use standard_io(c)
#use fast_io(d)
#use fast_io(e)

unsigned int16 adres_sec;
char  sutun_1[145],sutun_2[145],satir_1[320];
unsigned int yinele,data;
int t=0,degis=0,buton2=0;

char mesaj_1[]={'P','E','A','C','E',' ','I','N',' ','T','H','E',' ','W','O','R','L','D',' ',' ',' ',' '};
char mesaj_2[]={'B','A','R','I','S',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
char mesaj_3[]={'P','E','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
char mesaj_4[]={'P','E','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};

unsigned int karakter[]={0x3F,0x3F,0x48,0x3F,0x3f,0x00  //A 0
                        ,0x7f,0x49,0x49,0x49,0x36,0x00  //B 6
                        ,0x3e,0x41,0x41,0x41,0x22,0x00  //C 12
                        ,0x7f,0x41,0x41,0x41,0x3e,0x00  //D 18
                        ,0x7f,0x49,0x49,0x49,0x41,0x00  //E 24
                        ,0x7f,0x48,0x48,0x48,0x40,0x00  //F 30
                        ,0x3E,0x41,0x49,0x49,0x2E,0x00  //G 36
                        ,0x7F,0x08,0x08,0x08,0x7F,0x00  //H 42
                        ,0x41,0x7F,0x41,0x00,0x00,0x00  //I 48
                        ,0x11,0x5F,0x11,0x00,0x00,0x00  //İ 54
                        ,0x02,0x01,0x41,0x7e,0x40,0x00  //J 60
                        ,0x7f,0x08,0x14,0x22,0x41,0x00  //K 66
                        ,0x7f,0x01,0x01,0x01,0x01,0x00  //L 72
                        ,0x7f,0x20,0x18,0x20,0x7F,0x00  //M 78
                        ,0x7F,0x10,0x08,0x04,0x7F,0x00  //N 84
                        ,0x3E,0x41,0x41,0x41,0x3E,0x00  //O 90
                        ,0x7f,0x48,0x48,0x48,0x30,0x00  //P 96
                        ,0x3e,0x41,0x45,0x42,0x3d,0x00  //Q 102
                        ,0x7f,0x48,0x4C,0x4a,0x31,0x00  //R 108
                        ,0x32,0x49,0x49,0x49,0x26,0x00  //S 114
                        ,0x40,0x40,0x7F,0x40,0x40,0x00  //T 120
                        ,0x7E,0x01,0x01,0x01,0x7E,0x00  //U 126
                        ,0x1E,0x41,0x01,0x41,0x1E,0x00  //Ü 132
                        ,0x7C,0x02,0x01,0x02,0x7C,0x00  //V 138
                        ,0x7E,0x01,0x0E,0x01,0x7E,0x00  //W 144
                        ,0x63,0x14,0x08,0x14,0x63,0x00  //X 150
                        ,0x70,0x08,0x07,0x08,0x70,0x00  //Y 156
                        ,0x43,0x45,0x49,0x51,0x61,0x00  //Z 162
                        ,0x00,0x00,0x00,0x00,0x00,0x00  //Space 168
                        ,0x3E,0x45,0x49,0x51,0x3E,0x00  //0 174
                        ,0x21,0x7F,0x01,0x00            //1 178
                        ,0x21,0x43,0x45,0x49,0x31,0x00  //2  184
                        ,0x42,0x41,0x51,0x69,0x46,0x00  //3  190
                        ,0x0c,0x14,0x24,0x7f,0x04,0x00  //4  196
                        ,0x72,0x51,0x51,0x51,0x4e,0x00  //5  204
                        ,0x1e,0x29,0x49,0x49,0x06,0x00  //6  210
                        ,0x40,0x47,0x48,0x50,0x60,0x00  //7  216
                        ,0x36,0x49,0x49,0x49,0x36,0x00  //8  222
                        ,0x30,0x49,0x49,0x4a,0x3c,0x00  //9  228
                        ,0x1E,0x61,0x21,0x61,0x1E,0x00  //Ö  234
                        ,0x03,0x03,0x00                 //.  237
                        ,0x1B,0x1B,0x00                 //:  240
                        ,0x60,0x90,0x90,0x60,0x00       //'  245
                        ,0x09,0x09,0x09,0x09,0x09,0X00  //=  251
                        ,0x08,0x08,0x08,0x08,0X08,0x00  //-  257
                        ,0x00,0x03,0xFF,0xFF,0x03,0x00,0xFE,0xFF,0x03,0x03,0x02,0x00,0x00  //_ 270
                        ,0x00,0x10,0x3F,0xFF,0x00,0x00,0x3F,0xFF,0x60,0x60,0x20,0x00,0x00  //+ 283
                        ,0x60,0x92,0x94,0x68,0x16,0x29  //% 289
                        ,0x49,0x06,0x00                 //% 292
                        ,0x11,0x0f,0x11,0x10,0x08,0x00  //r
                        ,0x08,0x08,0x08,0x2a,0x1c,0x08,0x00  //>
                        ,0x00,0x03,0xFF,0xFF,0X03,0x00,0xFE,0xFF,0x03,0x03,0x02,0x00,0x00  //_ 361
                        ,0x00,0x10,0x3F,0xFF,0x00,0x00,0x3F,0xFF,0x60,0x60,0x20,0x00,0x00  //+ 374
                       
};

void data_sec()
   {
   switch (data)
   {
   case 'A':
   adres_sec=0 ; yinele=5 ; break ;
   case 'B':
   adres_sec=6 ; yinele=5 ; break;
   case 'C':
   adres_sec=12 ; yinele=5 ; break;
   case 'D':
   adres_sec=18 ; yinele=5 ; break;
   case 'E':
   adres_sec=24 ; yinele=5 ; break;
   case 'F':
   adres_sec=30 ; yinele=5 ; break;
   case 'G':
   adres_sec=36 ; yinele=5 ; break;
   case 'H':
   adres_sec=42 ; yinele=5 ; break;
   case 'I':
   adres_sec=48 ; yinele=5 ; break;
   case 'İ':
   adres_sec=54 ; yinele=5 ; break;
   case 'J':
   adres_sec=60 ; yinele=5 ; break;
   case 'K':
   adres_sec=66 ; yinele=5 ; break;
   case 'L':
   adres_sec=72 ; yinele=5 ; break;
   case 'M':
   adres_sec=78 ; yinele=5 ; break;
   case 'N':
   adres_sec=84 ; yinele=5 ; break;
   case 'O':
   adres_sec=90 ; yinele=5 ; break;
   case 'P':
   adres_sec=96 ; yinele=5 ; break;
   case 'Q':
   adres_sec=102 ; yinele=5 ; break;
   case 'R':
   adres_sec=108 ; yinele=5 ; break;
   case 'S':
   adres_sec=114 ; yinele=5 ; break;
   case 'T':
   adres_sec=120 ; yinele=5 ; break;
   case 'U':
   adres_sec=126 ; yinele=5 ; break;
   case 'Ü':
   adres_sec=132 ; yinele=5 ; break;
   case 'V':
   adres_sec=138 ; yinele=5 ; break;
   case 'W':
   adres_sec=144 ; yinele=5 ; break;
   case 'X':
   adres_sec=150 ; yinele=5 ; break;
   case 'Y':
   adres_sec=156 ; yinele=5 ; break;
   case 'Z':
   adres_sec=162 ; yinele=5 ; break;
   case ' ':
   adres_sec=168 ; yinele=5 ; break;
   case '0':
   adres_sec=174 ; yinele=5 ; break;
   case '1':
   adres_sec=180 ; yinele=3 ; break;
   case '2':
   adres_sec=184 ; yinele=5 ; break;
   case '3':
   adres_sec=190 ; yinele=5 ; break;
   case '4':
   adres_sec=196 ; yinele=5 ; break;
   case '5':
   adres_sec=202 ; yinele=5 ; break;
   case '6':
   adres_sec=208 ; yinele=5 ; break;
   case '9':
   adres_sec=226 ; yinele=5 ; break;
   case 'Ö':
   adres_sec=232 ; yinele=5 ; break;
   case '.':
   adres_sec=238 ; yinele=2 ; break;
   case ':':
   adres_sec=241 ; yinele=2 ; break;
   case '`':
   adres_sec=244 ; yinele=4 ; break;
   case '=':
   adres_sec=249 ; yinele=5 ; break;
   case '-':
   adres_sec=255 ; yinele=5 ; break;
   case '_':
   adres_sec=261 ; yinele=12 ; break;
   case '+':
   adres_sec=274 ; yinele=12 ; break;
   case '%':
   adres_sec=286 ; yinele=8 ; break;
   case 'r':
   adres_sec=295 ; yinele=5 ; break;
   case '>':
   adres_sec=301 ; yinele=6 ; break;
   case '*':
   adres_sec=308 ; yinele=12 ; break;
   case '/':
   adres_sec=321 ; yinele=12 ; break;
   default:
   adres_sec=164 ; yinele=5 ;
   break;
   }
   }
 
 
 void Animasyon_Sec()
{   
   //volatile int buton2=0;
   if(input(PIN_E2) & buton2==0)
   {
      degis++;
      buton2=1;
      if (degis>2)degis=1;
      if (degis<1)degis=2;
      output_high(PIN_E1);
      write_eeprom(1,degis);
      delay_ms(20);
      reset_cpu();
   }
   if(!input(PIN_E2))
   {
      buton2=0;   
      output_low(PIN_E1);
   }   
}
/**************************SÜTUN BİLGİSİ**************************/
void sutun_reg(char str[],int16 b)       //sutun_reg() alt programı.
{
 unsigned int j=0,i=0;                   //
 unsigned int16 y=0,stn_index;           //
 for(i=0;i<strlen(str);i++)              //
   {                                     //
   data=str[i];                          //
   data_sec();                           //
   for(j=0;j<=yinele;j++,adres_sec++,y++)//     
      sutun_1[y]=karakter[adres_sec];    // 
   }                                     //
 for(stn_index=y;stn_index<b;stn_index++)//
    sutun_1[stn_index]=0;                //
 y=0;                                    //


void sutun_reg_2(char str[],int16 b)       //sutun_reg() alt programı.
{
 unsigned int p=0,w=0;                   //
 unsigned int16 u=0,stn_index1;          //
 for(w=0;w<strlen(str);w++)              //
   {                                     //
   data=str[w];                          //
   data_sec();                           //
   for(p=0;p<=yinele;p++,adres_sec++,u++)//     
      sutun_2[u]=karakter[adres_sec];    // 
   }                                     //
 for(stn_index1=u;stn_index1<b;stn_index1++)//
    sutun_2[stn_index1]=0;                //
 u=0;                                    //
}                                          //

/*----------------------------------------------------------------------------*/
                                 
/*************************goto data display***************************/
void ekran_yaz(int tekrar)
{
 int s=0,i=0,j=0;
 for(j=0;j<tekrar;j++)
  {
  for(s=0;s<16;s++)
   {
   for(i=0;i<96;i++)
    {
     Animasyon_Sec();
     if(s<8)output_bit(ds1,bit_test(sutun_1[i],s));
     if(s>=8)output_bit(ds1,bit_test(sutun_2[i],s-7));
     output_high(clock);
     delay_us(1);
     output_low(clock);
    }
    if(s<8) output_b(0x00);
    if(s>=8)output_d(0x00);
    output_high(latch);
    delay_us(1);
    output_low(latch);
    if(s<8) output_b(s+1);
    if(s>=8 & s<16) output_d(s-6);
     
   
   
   }
  }
}
/*----------------------------------------------------------------------------*/



/***************************scroll message**************************/
void efekt_1(int16 kay , int mod)
{
 int reg_0=0;
 int16 n=0,k=0;
 for(n=0;n<kay;n++)
  {
   ekran_yaz(10);
   disable_interrupts(INT_RDA);
   switch (mod)
    {
    case 0:
      reg_0=sutun_1[0];
      for(k=0;k<(kay-1);k++)
         sutun_1[k]=sutun_1[k+1];
      sutun_1[kay-1]=reg_0;
      break;
    case 1:
      for(k=0;k<(kay-1);k++)
         sutun_1[k]=sutun_1[k+1];
      sutun_1[kay-1]=0;
      break;
    default:
      break;
    }
   enable_interrupts(INT_RDA);
  }
}


void efekt_2(int16 kay , int mod)
{
 int reg_0=0;
 int16 z=0,l=0;
 for(z=0;z<kay;z++)
  {
   Animasyon_Sec();
   ekran_yaz(1);
   disable_interrupts(INT_RDA);
   switch (mod)
    {
    case 0:
      reg_0=sutun_2[0];
      for(l=13;l<(kay-1);l++)
         sutun_2[l]=sutun_2[l+1];
      sutun_2[kay-1]=reg_0;
      break;
    case 1:
      for(l=13;l<(kay-1);l++)
         sutun_2[l]=sutun_2[l+1];
      sutun_2[kay-1]=0;
      break;
    default:
      break;
    }
   enable_interrupts(INT_RDA);
  }
}

void efekt_3(int16 yuk , int mod)
{
 int reg_0=0;
 int16 a=0,y=0;
 for(a=0;a<yuk;a++)
  {
   ekran_yaz(10);
   disable_interrupts(INT_RDA);
   switch (mod)
    {
    case 0:
      reg_0=satir_1[0];
      for(y=0;y<(yuk-1);y++)
         satir_1[y]=satir_1[y+1];
      satir_1[yuk-1]=reg_0;
      break;
    case 1:
      for(y=0;y<(yuk-1);y++)
         satir_1[y]=satir_1[y+1];
      satir_1[yuk-1]=0;
      break;
    default:
      break;
    }
   enable_interrupts(INT_RDA);
  }
}




/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*            main PROGRAM                   */
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
void main()
{
  int i=0;
   /*_______________________PORT GİRİŞ-ÇIKIŞ İŞLEMLERİ___________________________*/
   set_tris_a(0x00) ; set_tris_b(0x00) ;//pin_c7(RX) giriş,giğer 
   set_tris_d(0x00) ; set_tris_e(0x00) ;//pinler çıkış
   output_a(0x00)   ; output_b(0x00)   ;//bütün çıkışları
   output_d(0x00)   ; output_e(0x00)   ;//temizle
   /*----------------------------------------------------------------------------*/
   setup_adc_ports(NO_ANALOGS);           //adc pinleri digital
   setup_adc(ADC_OFF);                    //adc kapalı
   setup_psp(PSP_DISABLED);               //psp kapalı
   setup_spi(SPI_SS_DISABLED);            //spı kapalı
   setup_wdt(WDT_OFF);                    //wdt kapalı
   setup_timer_0(RTCC_INTERNAL);          //timer0 dahili kaynak
   setup_timer_1(T1_DISABLED);            //timer1 kapalı
   setup_timer_2(T2_DISABLED,0,1);        //timer2 kapalı
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);//timer3 kapalı
   /*----------------------------------------------------------------------------*/
   //enable_interrupts(INT_RDA);            //rs232 bilgi giriş kesmesi aktif
   //enable_interrupts(GLOBAL);             //tüm kesmelere izin ver
   /*----------------------------------------------------------------------------*/
   
   for(t=0;t<100;t++){
      sutun_1[t]=0;
      sutun_2[t]=0;
   }
   //rtc_init();
   degis=read_eeprom(1);
   //mesaj_1[] dizisine kopyala
   while(true)
   {
   /*********EEPROM'DAN SATIR BİLGİLERİNİ OKUMA VE SUTUN REGISTER'INA YAZMA*******/
  // for(i=0;i<4;i++)             //dahili eepromdan 55 karakter oku
  // mesaj_1[i]=read_eeprom(i);
   // char string[10], string2[10];
       Animasyon_Sec();
       switch(degis)
       {
       
   
        case 1:
                sutun_reg(mesaj_1,145);     break;   
                sutun_reg_2(mesaj_2,1);
       
               
       
        case 2:
                sutun_reg(mesaj_3,145); break;       
                sutun_reg_2(mesaj_4,1);
               
               
         
       }
   /*----------------------------------------------------------------------------*/
   
   /***************************MESAJ RUTİNİ***************************/
   // ekran_yaz(320);
   
   // efekt_1(300,1);
   
    efekt_2(145,1);
   
   // efekt_3(320,1);
   /*----------------------------------------------------------------------------*/
   
   
   }
}

_________________
electronic
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group