If you, like me, came here. See how I solved my problem.
The general check digit corresponds to the 5th position of the bar code. The digit 0 (zero) in the 5th position will indicate that the bar code has no check digit;
Assign the corresponding weights (from 2 to 9) for each of the 43 digits (except the DV itself) of the Bar Code, starting from right to left;
Multiply each digit by its corresponding weight. The first digit from right to left by 2, the second digit by 3, and so on until arriving at weight 9, when it resumes with weight 2;
Accumulate the result of each multiplication;
Divide the result of the sum by 11 (eleven);
Identify the rest of the division;
My problem lies precisely in this last line of the algorithm:
//Agora que tenho a soma vamos pegar o resto da divisão por 11
mod = 11-(soma % 11);
//Se o resultado da subtração for 0 (zero), 1 (um) ou maior que 9 (nove), o dígito verificador será 1 (um). Senão o DV é o próprio resultado da subtração.
if (mod == 0 || mod == 1 || mod > 9)
{
dv = 1;
}
DvGeral = dv;
The check digit will be the result of the subtraction: 11 - remainder of the division. If the subtraction result is 0 (zero), 1 (one) or greater than 9 (nine), the check digit will be 1 (one). Otherwise DV is the very result of subtraction.
But having helped someone was worth it