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

Hi I have a hard time to appeal has a void in the process wh

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



Joined: 17 Mar 2015
Posts: 4

View user's profile Send private message Send e-mail

Hi I have a hard time to appeal has a void in the process wh
PostPosted: Tue Mar 17, 2015 11:09 am     Reply with quote

Code:

#include "C:\Users\Heiden\Desktop\Mini Projet\programme\matrix.h"
#include <string.h>
#include <stdlib.h>
#use rs232(UART1,BAUD=9600,TIMEOUT=1500,bits=8)
#byte INTCON=0xB
#byte timer0= 0x01
#bit RBIF = INTCON.0
#bit INTF = INTCON.1
#bit TMR0IF = INTCON.2
#bit RBIE = INTCON.3
#bit INTE = INTCON.4
#bit TMR0IE = INTCON.5
#bit PEIE = INTCON.6
#bit GIE = INTCON.7
#byte ADCON0 = 0x1F
//
#define Latch PIN_C0
#define RB0 PIN_B0
#define RB1 PIN_B1
#include <string.h>
#include <stdlib.h>

int i,rafraichir,dat,vitesse;
char HC595_0,HC595_1,HC595_2;
char uart_read,j,xx=0;
unsigned int uart_read_t;
char new_tab[] ={
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0,      };
// Tableau de caractères sur 8 bits installés en ROM

const unsigned short ASCII[] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace
        0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0x00, 0x00,  // Code pour char !
        0x00, 0x24, 0x7E, 0x24, 0x24, 0x7E, 0x24, 0x00,  // Code pour char #  1
        0x00, 0x26, 0x49, 0x49, 0xFF, 0x49, 0x32, 0x00,  // Code pour char $  2
        0x00, 0x46, 0x26, 0x10, 0x08, 0x64, 0x62, 0x00,  // Code pour char %  3
        0x00, 0x70, 0x8E, 0x89, 0x99, 0x76, 0xC0, 0x00,  // Code pour char &  4
        0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char '  5
        0x00, 0x7E, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char (  6
        0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x7E, 0x00,  // Code pour char )  7
        0x00, 0x00, 0x0A, 0x04, 0x0A, 0x00, 0x00, 0x00,  // Code pour char *  8
        0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00,  // Code pour char +  9
        0x00, 0x00, 0x00, 0x80, 0x60, 0x00, 0x00, 0x00,  // Code pour char ,  10
        0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,  // Code pour char -  11
        0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,  // Code pour char .  12
        0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,  // Code pour char /  13
        0x00, 0x7E, 0xC1, 0xB1, 0x8D, 0x83, 0x7E, 0x00,  // Code pour char 0  14
        0x00, 0x04, 0x02, 0x01, 0xFF, 0x00, 0x00, 0x00,  // Code pour char 1  15
        0x00, 0xE6, 0x91, 0x91, 0x89, 0x89, 0x86, 0x00,  // Code pour char 2  16
        0x00, 0x42, 0x81, 0x89, 0x89, 0x89, 0x76, 0x00,  // Code pour char 3  17
        0x00, 0x30, 0x28, 0x24, 0x22, 0xFF, 0x20, 0x00,  // Code pour char 4  18
        0x00, 0x4F, 0x89, 0x89, 0x89, 0x89, 0x71, 0x00,  // Code pour char 5  19
        0x00, 0x7E, 0x89, 0x89, 0x89, 0x89, 0x72, 0x00,  // Code pour char 6  20
        0x00, 0x01, 0x01, 0xF1, 0x09, 0x05, 0x03, 0x00,  // Code pour char 7  21
        0x00, 0x76, 0x89, 0x89, 0x89, 0x89, 0x76, 0x00,  // Code pour char 8  22
        0x00, 0x4E, 0x91, 0x91, 0x91, 0x91, 0x7E, 0x00,  // Code pour char 9  23
        0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00,  // Code pour char :  24
        0x00, 0x00, 0x80, 0x68, 0x00, 0x00, 0x00, 0x00,  // Code pour char ;  25
        0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,  // Code pour char <  26
        0x00, 0x00, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00,  // Code pour char =  27
        0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x00, 0x00,  // Code pour char >  28
        0x00, 0x06, 0x01, 0xB1, 0x09, 0x09, 0x06, 0x00,  // Code pour char ?  29
        0x00, 0x7E, 0x99, 0xA5, 0xA5, 0xB9, 0x5E, 0x00,  // Code pour char @  30
        0x00, 0xE0, 0x1C, 0x13, 0x13, 0x1C, 0xE0, 0x00,  // Code pour char A  31
        0x00, 0xFF, 0x89, 0x89, 0x89, 0x8E, 0x70, 0x00,  // Code pour char B  32
        0x00, 0x7E, 0x81, 0x81, 0x81, 0x81, 0x42, 0x00,  // Code pour char C  33
        0x00, 0xFF, 0x81, 0x81, 0x81, 0x42, 0x3C, 0x00,  // Code pour char D  34
        0x00, 0xFF, 0x89, 0x89, 0x89, 0x81, 0x81, 0x00,  // Code pour char E  35
        0x00, 0xFF, 0x09, 0x09, 0x09, 0x01, 0x01, 0x00,  // Code pour char F  36
        0x00, 0x7E, 0x81, 0x91, 0x91, 0x51, 0xF2, 0x00,  // Code pour char G  37
        0x00, 0xFF, 0x08, 0x08, 0x08, 0x08, 0xFF, 0x00,  // Code pour char H  38
        0x00, 0x00, 0x81, 0xFF, 0x81, 0x00, 0x00, 0x00,  // Code pour char I  39
        0x00, 0x60, 0x80, 0x80, 0x80, 0x80, 0x7F, 0x00,  // Code pour char J  40
        0x00, 0xFF, 0x08, 0x18, 0x24, 0x42, 0x81, 0x00,  // Code pour char K  41
        0x00, 0xFF, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,  // Code pour char L  42
        0x00, 0xFF, 0x02, 0x0C, 0x0C, 0x02, 0xFF, 0x00,  // Code pour char M  43
        0x00, 0xFF, 0x03, 0x0C, 0x30, 0xC0, 0xFF, 0x00,  // Code pour char N  44
        0x00, 0x7E, 0x81, 0x81, 0x81, 0x81, 0x7E, 0x00,  // Code pour char O  45
        0x00, 0xFF, 0x11, 0x11, 0x11, 0x11, 0x0E, 0x00,  // Code pour char P  46
        0x00, 0x7E, 0x81, 0x81, 0xA1, 0x41, 0xBE, 0x00,  // Code pour char Q  46
        0x00, 0xFF, 0x09, 0x09, 0x09, 0x39, 0xC6, 0x00,  // Code pour char R  47
        0x00, 0x46, 0x89, 0x89, 0x89, 0x89, 0x72, 0x00,  // Code pour char S  48
        0x00, 0x00, 0x01, 0x01, 0xFF, 0x01, 0x01, 0x00,  // Code pour char T  49
        0x00, 0x7F, 0x80, 0x80, 0x80, 0x80, 0x7F, 0x00,  // Code pour char U  50
        0x00, 0x0F, 0x30, 0xC0, 0xC0, 0x30, 0x0F, 0x00,  // Code pour char V  51
        0x00, 0x7F, 0x80, 0x70, 0x70, 0x80, 0x7F, 0x00,  // Code pour char W  52
        0x00, 0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00, 0x00,  // Code pour char x  84
        0x00, 0x07, 0x08, 0xF0, 0xF0, 0x08, 0x07, 0x00,  // Code pour char Y  53
        0x00, 0xC1, 0xA1, 0x91, 0x89, 0x85, 0x83, 0x00,  // Code pour char Z  54
        0x00, 0xFF, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char [  55
        0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00,  // Code pour char BackSlash
        0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFF, 0x00,  // Code pour char ]  57
        0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x00, 0x00,  // Code pour char ^  58
        0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,  // Code pour char _  59
        0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,  // Code pour char `  60
        0x00, 0x00, 0x20, 0x54, 0x54, 0x78, 0x00, 0x00,  // Code pour char a  61
        0x00, 0x00, 0x7E, 0x48, 0x48, 0x30, 0x00, 0x00,  // Code pour char b  62
        0x00, 0x00, 0x38, 0x44, 0x44, 0x28, 0x00, 0x00,  // Code pour char c  63
        0x00, 0x00, 0x30, 0x48, 0x48, 0x7E, 0x00, 0x00,  // Code pour char d  64
        0x00, 0x00, 0x38, 0x54, 0x54, 0x58, 0x00, 0x00,  // Code pour char e  65
        0x00, 0x00, 0x7C, 0x0A, 0x0A, 0x02, 0x00, 0x00,  // Code pour char f  66
        0x00, 0x00, 0x18, 0xA4, 0xA8, 0x7C, 0x00, 0x00,  // Code pour char g  67
        0x00, 0x00, 0x7E, 0x08, 0x08, 0x70, 0x00, 0x00,  // Code pour char h  68
        0x00, 0x00, 0x00, 0x7A, 0x00, 0x00, 0x00, 0x00,  // Code pour char i  69
        0x00, 0x00, 0x80, 0x80, 0x7A, 0x00, 0x00, 0x00,  // Code pour char j  70
        0x00, 0x00, 0x7E, 0x10, 0x28, 0x40, 0x00, 0x00,  // Code pour char k  71
        0x00, 0x00, 0x00, 0x7E, 0x40, 0x00, 0x00, 0x00,  // Code pour char l  72
        0x00, 0x7C, 0x08, 0x04, 0x78, 0x04, 0x78, 0x00,  // Code pour char m  73
        0x00, 0x00, 0x7C, 0x08, 0x04, 0x78, 0x00, 0x00,  // Code pour char n  74
        0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00,  // Code pour char o  75
        0x00, 0x00, 0xFC, 0x28, 0x24, 0x18, 0x00, 0x00,  // Code pour char p  76
        0x00, 0x00, 0x18, 0x24, 0x28, 0xFC, 0x00, 0x00,  // Code pour char q  77
        0x00, 0x00, 0x7C, 0x08, 0x04, 0x08, 0x00, 0x00,  // Code pour char r  78
        0x00, 0x00, 0x08, 0x54, 0x54, 0x20, 0x00, 0x00,  // Code pour char s  79
        0x00, 0x00, 0x3E, 0x48, 0x40, 0x00, 0x00, 0x00,  // Code pour char t  80
        0x00, 0x00, 0x3C, 0x40, 0x40, 0x3C, 0x00, 0x00,  // Code pour char u  81
        0x00, 0x00, 0x1C, 0x60, 0x60, 0x1C, 0x00, 0x00,  // Code pour char v  82
        0x00, 0x3C, 0x40, 0x70, 0x70, 0x40, 0x3C, 0x00,  // Code pour char w  83
        0x00, 0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00, 0x00,  // Code pour char x  84
        0x00, 0x00, 0x0C, 0x90, 0x90, 0x7C, 0x00, 0x00,  // Code pour char y  85
        0x00, 0x00, 0x64, 0x54, 0x54, 0x4C, 0x00, 0x00,  // Code pour char z  86
        0x00, 0x00, 0x08, 0x76, 0x81, 0x00, 0x00, 0x00,  // Code pour char {  87
        0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,  // Code pour char |  88
        0x00, 0x00, 0x00, 0x81, 0x76, 0x08, 0x00, 0x00,  // Code pour char }  89
        0x00, 0x00, 0x10, 0x08, 0x10, 0x08, 0x00, 0x00,  // Code pour char ~    94 lignes
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   90
        0x00, 0xFF, 0x08, 0x08, 0x08, 0x08, 0xFF, 0x00,  // Code pour char H        91
        0x00, 0xFF, 0x89, 0x89, 0x89, 0x81, 0x81, 0x00,  // Code pour char E        92
        0x00, 0xE0, 0x1C, 0x13, 0x13, 0x1C, 0xE0, 0x00,  // Code pour char A        93
        0x00, 0xFF, 0x09, 0x09, 0x09, 0x39, 0xC6, 0x00,  // Code pour char R        94
        0x00, 0x00, 0x01, 0x01, 0xFF, 0x01, 0x01, 0x00,  // Code pour char T        95
        0x00, 0x07, 0x08, 0xF0, 0xF0, 0x08, 0x07, 0x00,  // Code pour char Y        96
        0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,  // Code pour char .        97
        0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,  // Code pour char .        98
        0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00,  // Code pour char . 832    99
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  // Code pour char .        100
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   101
        0x0E, 0x1F, 0x3E, 0xFC, 0xFC, 0x3E, 0x1F, 0x0E,  // Code for char  ----     102
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   103
        0x08, 0x1C, 0x8A, 0xFF, 0xFF, 0x8A, 0x1C, 0x08,  // Code for char !         104
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   105
        0x3C, 0x6E, 0xDB, 0xDF, 0xDF, 0xDB, 0x6E, 0x3C,  // Code for char "         106
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   107
        0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,  // Code for char #         108
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   109
        0x00, 0x32, 0x62, 0x60, 0x60, 0x62, 0x32, 0x00,  // Code for char $         110
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   111
        0x80, 0x60, 0x7E, 0xFF, 0xFF, 0x7E, 0x60, 0x80,  // Code for char %         112
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   113
        0xFF, 0x81, 0xBD, 0xA5, 0xA5, 0xBD, 0x81, 0xFF,  // Code for char &         114
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   115
        0x00, 0x7E, 0x42, 0x5A, 0x5A, 0x42, 0x7E, 0x00,  // Code for char '         116
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   117
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   118
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // Code pour char Espace   119
         };
         char timed_getc() {
   unsigned int16 timeout;
   char retval;

   timeout=0;
   while(!kbhit() && (++timeout< 500000))
      delay_us(10);
   if(kbhit())
      retval = getc();
   else
      retval = 0;
   return(retval);
}
//////////////////////////////////////         
void get_string(char* s, unsigned int8 max)
{
   unsigned int8 len;
   char c;

   --max;
   len=0;
   do {
     c=getc();
     if(c==8) {  // Backspace
        if(len>0) {
          len--;
          putc(c);
          putc(' ');
          putc(c);
        }
     } else if ((c>=' ')&&(c<='~'))
       if(len<=max) {
         s[len++]=c;
         putc(c);
       }
   } while(c!=13);
   s[len]=0;
}   //end void get_string(char* s, unsigned int8 max)
//////////////////////
signed int16 get_int()
{
  char s[5];
  signed int16 i;

  get_string(s, 5);

  i=atol(s);
  return(i);
}
///////
void interrupt() {
  rafraichir++;
  vitesse++;
  Timer0   = 240;
  INTCON = 0x20;
                 }

//******************************************************************************
void send_data(char HC595_0, char HC595_1, char HC595_2)
{
  Spi_Write(HC595_0);     // data first circuit
  Spi_Write(HC595_1);     // second circuit data
  Spi_Write(HC595_2);     // Data Third Circuit
  output_high(Latch);
  output_low(Latch);

}
//******************************************************************************

void test()
{   
         output_c (0x00);
if(rafraichir>=150){
if (vitesse>=3000){  // Frame rate
              dat++; // scrolling caractères
              vitesse=0;

            }

                    rafraichir=0;
                    output_high(RB0);       // pulse input clock
                    output_low(RB0);      // du 4017

             if(i>=8)           // counter on all bytes of the table
              {
                i=0;
                    output_high(RB1);       // pulse input clock
                    output_low(RB1);
                 }  // fin de If
                  i++;

              HC595_0=new_tab[i+dat];       // data on the first 595
              HC595_1=new_tab[(i+8)+dat];   // data on the second 595
              HC595_2=new_tab[(i+16)+dat];   // the third data 595
              send_data(HC595_0,HC595_1,HC595_2);   // sends the data to display
              Delay_ms(1);

                          } // end of If
           if(dat>=64)     // When we get to the last character
                    {
                   // RB2_bit=0;
                        dat=0;   // Returning to the beginning of the table

                    }



}
void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_4);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   // TODO: USER CODE!!
  INTCON=0xA0; 
  TMR0IE=0;
  ADCON0=0;
    output_a(0x00) ;
    output_b(0x00) ;
    output_c(0x00) ;
  rafraichir=0;                     // refresh characters
  i=0;
while(true)
 {
 //interrupt() ;
   test();
    // data first circuit
 IF (kbhit ())
    {
        uart_read=timed_getc();
        if(uart_read== 4 ){

                    TMR0IE=~TMR0IE;
                    dat=0;
                    xx=0;
                              }
             else{
                 uart_read-=31;
                 uart_read_t=uart_read*8;
                 for(j=0;j<8;j++){
                  new_tab[j+xx+24]=ASCII[uart_read_t+j];
                                 }

                  xx+=8;
                  if(xx>80)xx=0;

                 }
                                    }

           }  //end of while
             }
temtronic



Joined: 01 Jul 2010
Posts: 9136
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 17, 2015 11:57 am     Reply with quote

Honestly, there is SO much WRONG with your 'cut and pasted' code , it can't possibly work.
First line is supposed to be the processor type, after that it gets worse. Have a look at ANY of the CCS supplied examples... press F11 while your project is open, do NOT 'cut and paste' another compilers C into CCS ,it will NOT work...
I strongly suggest you get a '1Hz LED' program to compile and run,then come back.
You also need to get into the habit of commenting every line of code as well as every function. Nobody is going to waste time trying to figure out what you're attempting to do, it's just a mess, frankly.

Start small, build upon code you KNOW works....


Jay
mohamed_amine



Joined: 17 Mar 2015
Posts: 4

View user's profile Send private message Send e-mail

PostPosted: Tue Mar 17, 2015 12:23 pm     Reply with quote

thx
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