Sending messages irregularly

Hi I've written a program to send CAN messages, basically it's a type of message it's not that important to my problem. My program however sends these irregularly. I've got two millis functions and one sends every 10ms and the other every 100ms.

It sends the 10ms ten times before sending the 100ms messages. And then it seems to take a long time before sending 10ms messages again. Is there anything I could do simplify the code that sends messages every100ms?

PS:I didn't attach the CAN functions since they seem unnecessary otherwise they where in the bottom of the program.

//millis var
unsigned long interval100 = 100;
unsigned long previousMillis100 = 0;

unsigned long interval10 = 10;
unsigned long previousMillis10 = 0;

//switch var 100ms
int nummer;//till 100ms meddelanden
int num50c00;//till 50c ID 10 olika til de olika 
int num50c01;
int num50c02;
int num50c03;

//switch var 10ms
int nummer10;



void setup() {//==========================================

Can0.begin(CAN_BPS_500K);
delay(500);

}

void loop() {
  
unsigned long currentMillis=millis();

if((unsigned long)(currentMillis - previousMillis10) >= interval10){
  
   if (nummer10==4) nummer10=0;
switch (nummer10){
  case 0:
    Meddelande11A1();
    Meddelande1F21();
    Meddelande1D41();
    Meddelande1DA1();
  break;
  case 1:
    Meddelande11A2();
    Meddelande1F22();
    Meddelande1D42();
    Meddelande1DA2();
  break;
  case 2:
    Meddelande11A3();
    Meddelande1F23();
    Meddelande1D43();
    Meddelande1DA3();
  break;
  case 3:
    Meddelande11A4();
    Meddelande1F24();
    Meddelande1D44();
    Meddelande1DA4();
  break;
}//switch loop end
nummer10++;
previousMillis10=millis();
}//millis10 loop end



if((unsigned long)(currentMillis - previousMillis100) >= interval100){

Meddelande50B();
Meddelande54B();
Meddelande54C();
Meddelande55A();
  if (nummer==4) nummer=0;
switch (nummer){
   case 0:
   Meddelande50A1();
   Meddelande54F1();
   Meddelande54A1();
      if(num50c00==5) num50c00=0;
      switch(num50c00){
        case 0:
          Meddelande0050C124();
        break;
        case 1:
          Meddelande0050C124();
        break;
        case 2:
          Meddelande0050C35();
        break;
        case 3:
          Meddelande0050C124();
        break;
        case 4:
          Meddelande0050C35();
        break;
      }
   num50c00++;
  break;
  case 1:
   Meddelande50A2();
   Meddelande54F2();
   Meddelande54A2();
   
      if(num50c01==5) num50c01=0;
    
      switch(num50c01){
        case 0:
          Meddelande0150C14();
        break;
        case 1:
          Meddelande0150C2();
        break;
        case 2:
          Meddelande0150C35();
        break;
        case 3:
          Meddelande0150C14();
        break;
        case 4:
          Meddelande0150C35();
        break;

      }
num50c01++;


  break;
  case 2:
   Meddelande50A3();
   Meddelande54F3();
   Meddelande54A1();
   
      if(num50c02==5) num50c02=0;
      switch(num50c02){
        case 0:
          Meddelande0250C14();
        break;
        case 1:
          Meddelande0250C2();
        break;
        case 2:
          Meddelande0250C3();
        break;
        case 3:
          Meddelande0250C14();
        break;
        case 4:
          Meddelande0250C5();
        break;
      }
  num50c02++;

  break;
  case 3:
   Meddelande50A4();
   Meddelande54F4();
   Meddelande54A2();
   
      if(num50c03==5) num50c03=0; 
      switch(num50c03){
        case 0:
          Meddelande0350C1();
        break;
        case 1:
          Meddelande0350C24();
        break;
        case 2:
          Meddelande0350C3();
        break;
        case 3:
          Meddelande0350C24();
        break;
        case 4:
          Meddelande0350C5();
        break;
      }

num50c03++;
  
  break;

}//switchloop end


previousMillis100=millis();
nummer++;

}//millisloop end



}//voidloop end

(deleted)

    previousMillis10 = millis();
    previousMillis100 = millis();

These will extend the delay between messages if the code takes more than a millisecond to complete. Recommended methods are:

    previousMillis10 += interval10;
    previousMillis100 += interval100;

Or, if it is important to keep the loops synchronized:

    previousMillis10 = currentMillis;
    previousMillis100 = currentMillis;

Your code is so badly layed out that I'm not even going to look at the snippet you provided.

It's not up to you to decided which parts of the code to post. learn to read and follow instructions.

Mark

Your biggest problem is that nobody can understand the program. please use the autoformatter in the IDE and send the ENTIRE program.

-- DH