Splitting code.Several tabs not working...

First of all, sorry for my English.

I don't want to create a library , i only want to separete my code and some declarations and functions.
I have created two tabs:

my_program (the main ino file, with startup,loop,etc)

a_fonts a file containing only the next declaration:

unsigned char font_8x8[] = {0x00, 0xad.........}

i can't see the font_8x8 array from the main file....

As the manual says, the ide concats these files alphabetically...

The ide named with the extension .ino the TWO files.....

what's wrong?

my_program (the main ino file, with startup,loop,etc)

my_program.what? Details matter, a great deal.

a_fonts a file containing only the next declaration:

a_fonts.what?

i can't see the font_8x8 array from the main file....

I can't, either.

As the manual says, the ide concats these files alphabetically...

The order matters to people, not computers.

The ide named with the extension .ino the TWO files.....

And you failed to show either one.

what's wrong?

I'm going way (an inch or more) out on a limb here and guess operator error.

It should work perfectly well with two .ino files, but you need to tell us the exact names of the files and post their content.

The IDE will load the principal .ino file first (the one with the same name as the directory) and the other file(s) after that in alphabetical order. Code in a later file can "see" global variables in an earlier file, but not vice versa.

If necessary you could give the second file a .h extension and the use #include "secondFile.h" to load it. Note the quotation marks.

...R

OK, here are the complete code and names:

main file. Name: lectura_comandos.ino

#define COL_PIXEL     64
#define ROW_PIXEL     16


int latchPin=8; //LT
int clockPin=12;//SK
int dataPin=11; //R1

int en_74138 = 2;
int la_74138 = 3;
int lb_74138 = 4;
int lc_74138 = 5;
int ld_74138 = 6;
 
unsigned int ROW_xPixel;
unsigned int ROW_num;
unsigned char Col_num_1;
unsigned char Col_num_2;
unsigned char Col_num_3;
unsigned char Col_num_4;
unsigned char Col_num_5;
unsigned char Col_num_6;
unsigned char Col_num_7;
unsigned char Col_num_8;


//****************************DEFINICIOES MIAS******************************************//

String comandoDeEntrada = "";      
boolean comandoRecibido = false;  
boolean a = false; 
unsigned char buffer[]={
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,                              
 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0                               
};

unsigned char letra_ab[16]={0x00,0x78,0x84,0x84,0xFC,0x84,0x84,0x00,0x00,0xF8,0x84,0xF8,0x84,0x84,0xF8,0x00};


//*************************************************************************************//
//*************************************************************************************//





//*****************SETUP****************//


void setup() {
  
pinMode(latchPin,OUTPUT);
pinMode(clockPin,OUTPUT);
pinMode(dataPin,OUTPUT);
pinMode(en_74138,OUTPUT);
pinMode(la_74138,OUTPUT);
pinMode(lb_74138,OUTPUT);
pinMode(lc_74138,OUTPUT);
pinMode(ld_74138,OUTPUT);
digitalWrite(en_74138, LOW);

//traducir caracteres
for (int n=0;n<16;n++){
traducir_a_reverseDobleBit(letra_ab[n],buffer[n*16],buffer[(n*16)+1]);
letra_ab[1]=fuente[2];
}
  
Serial.begin(9600);
comandoDeEntrada.reserve(200);
}
//**************************************//





//*************FUNCIONES MATRIX******************//
void shiftOut(unsigned char dataOut)
{
  
    for(int i=0;i<=7;i++)
   {
      PORTB &=~(1<<(6));//PB6 = 0 equate digitalWrite(clockPin,LOW);
       
     if(dataOut & (0x01<<i))  PORTB |=1<<(5); //PB5=1 equate digitalWrite(dataPin,HIGH);
     else  PORTB &=~(1<<(5));//PB5 = 0 equate digitalWrite(clockPin,LOW);
     
     PORTB |=1<<(6);//PB6=1 equate digitalWrite(clockPin,HIGH);
     
   }
}

//Combine 2 bits/pixel to 1 bits/pixel 
unsigned char Combine_2BitsTo1Bit(unsigned char num,unsigned char *BMP)
{
  
  unsigned char Col_num_tem_1;
  unsigned char Col_num_tem_2;
  unsigned int Col_num_tem = 0;
  unsigned char i=0;
  unsigned char Col_num_1bit = 0x00;
  
  Col_num_tem_1 = *(BMP+num);
  Col_num_tem_2 = *(BMP+num+1);
  
  Col_num_tem = Col_num_tem_1;
  Col_num_tem |= (Col_num_tem_2 << 8);
  
 for(i=0;i<8;i++)
  {   
    if(Col_num_tem&(0x0003<<i*2)) Col_num_1bit |= (0x01<<i);
  }
  return ~Col_num_1bit;
}


//display one picture 
void display_matrix(unsigned char *BMP, int delay_refresco, int sustain)
{
  //Display count
  unsigned int dis_cnt=256;
  unsigned int i;
  
   for(i=0;i<sustain;i++)
   {
     
     digitalWrite(en_74138, HIGH);//Turn off display
  
     //Col scanning
    shiftOut(Col_num_1);
    shiftOut(Col_num_2);
    shiftOut(Col_num_3);
    shiftOut(Col_num_4);
    shiftOut(Col_num_5);
    shiftOut(Col_num_6);
    shiftOut(Col_num_7);
    shiftOut(Col_num_8);
  
    digitalWrite(latchPin, LOW);
    digitalWrite(latchPin, HIGH);
  
    //Row scanning
    // AVR Port Operation 
    //PORTD = ((ROW_xPixel << 3 ) & 0X78) | (PORTD & 0X87);//Write PIN 3 4 5 6 la_74138 lb_74138 lc_74138 ld_74138
    PORTE = ((ROW_xPixel << (5-0) ) & 0X20) | (PORTE & 0XDF);////Write PIN 3(PE5) la_74138
    PORTG = ((ROW_xPixel << (5-1) ) & 0X20) | (PORTG & 0XDF);////Write PIN 4(PG5) lb_74138
    PORTE = ((ROW_xPixel << (3-2) ) & 0X08) | (PORTE & 0XF7);////Write PIN 5(PE3) lc_74138
    PORTH = ((ROW_xPixel << (3-3) ) & 0X08) | (PORTH & 0XF7);////Write PIN 5(PH3) ld_74138
     
    digitalWrite(en_74138, LOW);//Turn on display


     
    if(ROW_xPixel==15) ROW_xPixel=0; else ROW_xPixel++;
  
   
   
   /*
   // Single color,1 bits/pixel
   Col_num_1=~BMP[(COL_PIXEL/8)*ROW_xPixel];
   Col_num_2=~BMP[(COL_PIXEL/8)*ROW_xPixel+1];
   Col_num_3=~BMP[(COL_PIXEL/8)*ROW_xPixel+2];
   Col_num_4=~BMP[(COL_PIXEL/8)*ROW_xPixel+3];
   Col_num_5=~BMP[(COL_PIXEL/8)*ROW_xPixel+4];
   Col_num_6=~BMP[(COL_PIXEL/8)*ROW_xPixel+5];
   Col_num_7=~BMP[(COL_PIXEL/8)*ROW_xPixel+6];
   Col_num_8=~BMP[(COL_PIXEL/8)*ROW_xPixel+7];
 
  */
  
   //Single color,2 bits/pixel 
   Col_num_1 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2,BMP);
   Col_num_2 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+2,BMP);
   Col_num_3 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+4,BMP);
   Col_num_4 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+6,BMP);
   Col_num_5 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+8,BMP);
   Col_num_6 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+10,BMP);
   Col_num_7 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+12,BMP);
   Col_num_8 = Combine_2BitsTo1Bit((COL_PIXEL/8)*ROW_xPixel*2+14,BMP);
  
 
  if (delay_refresco > 0) {
  delayMicroseconds(delay_refresco); 
  }
   
   
  }
  
}



  
void loop() {   
//  display_matrix(buffer,0,1000);
  digitalWrite(en_74138, HIGH);
   
}


byte getVal(char c)
{
   if(c >= '0' && c <= '9')
     return (byte)(c - '0');
   else
     return (byte)(c-'A'+10);
}



void traducir_a_reverseDobleBit(unsigned char bits_origen, unsigned char &bits_altos_destino,unsigned char &bits_bajos_destino)
{ 

unsigned char tabla_equivalencia[16] =
{0x0,  // 0  
 0xc0,  // 1  
 0x30,  // 2  
 0xf0,  // 3  
 0xc,   // 4  
 0xcc,  // 5  
 0x3c,  // 6  
 0xfc,  // 7  
 0x3,   // 8  
 0xc3,  // 9  
 0x33,  //10  
 0xf3,  //11  
 0xf,   //12  
 0xcf,  //13  
 0x3f,  //14  
 0xff }; //15  

//char x[16] = {0x0a,0x1b,0x2c,0x3d,0x4e,0x5f,0x60,0x71,0x82,0x93,0xA4,0xB5,0xC6,0xD7,0xE8,0xF9};

// obtener 4 bits altos y 4 bits bajos por separado.
  
  byte bits_altos=bits_origen;
  bits_altos=bits_altos>>4; //dividir por 16 sin resto
  
  byte bits_bajos=bits_origen & B00001111; //quedarse solo con los 4 bits bajos.


  //obtener valor equivalente displayable en la matriz.          
  bits_bajos_destino=tabla_equivalencia[bits_bajos];
  bits_altos_destino=tabla_equivalencia[bits_altos];


  byte imprime1=bits_altos_destino;
  byte imprime2=bits_bajos_destino;
  byte imprime3=bits_altos;
  byte imprime4=bits_bajos;
  
 
  /*
  Serial.print("Bits altos Origen:");
  Serial.print(imprime3);
  Serial.print(" -> ");
  Serial.println(imprime1);
  
  Serial.print("Bits bajos Origen:");
  Serial.print(imprime4);
  Serial.print(" -> ");
  Serial.println(imprime2);
 */
  
}


void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read(); 
    comandoDeEntrada += inChar;
    if (inChar == '\n') {  //configurar serie con "nueva linea"
       comandoRecibido = true;
    } 
  }
}

The second file. Name: a_fuentes.ino (created adding a tab).

char fuente[764]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  // <space>
0x08,0x08,0x08,0x08,0x08,0x00,0x08,0x00,  // !
0x14,0x14,0x00,0x00,0x00,0x00,0x00,0x00,  // "
0x00,0x24,0x7E,0x24,0x24,0x7E,0x24,0x00,  // #
0x10,0x7C,0x50,0x7C,0x14,0x7C,0x10,0x00,  // $
0x00,0x62,0x64,0x08,0x10,0x26,0x46,0x00,  // %
0x00,0x10,0x28,0x10,0x2A,0x44,0x3A,0x00,  // &
..
..

};

In the second file i have deleted the last values of the matrix, because i was getting an error (post too long).

When i compile the project, i get the error:

lectura_comandos:85: error: 'fuente' was not declared in this scope

Renaming a_fuentes.ino to a_fuentes.h, and adding a #include statement allows the code to compile. Files should have appropriate extensions. The ino extension is for files that contain functions. The a_fuentes.ino file does not contain functions.

File renamed to a_fuentes.h
and added #include "fuentes.h" in the other file.

Now it works!. Thanks a lot.

Now, i have moved some fucntions into another tab. This works too, but
reserved words and some functions like "PORTB" doesn't work in another tabs.
I need some standard includes in the tabs, isn't it?

I need some standard includes in the tabs, isn't it?

Depends on the extension of the tab. If the extension is .ino, no. All .ino files are combined into one .cpp file for compilation.

Ok.
In my .h file i have added #include <Arduino.h> and now all works. Thanks a lot!.