Siii. J'ai fait une boulettes.
Code : Tout sélectionner
macro_command main()
// Declaration de variables
int retour // Mot retour info communication
short MotdeVie // Mot de vie pour la communication
int Table_Envoie[64] // Table d'echange a envoyer
int Table_Reception[16] // Table d'echange a recevoir
unsigned char response[32]
// ***********************
// * Programma principal *
// ***********************
// ECHANGE DES DONNÉES
GetData(MotdeVie, "CPU1284", 3x, 1 ,1)
SetData(MotdeVie, "Local HMI", LW, 3, 1) // Retour info communication
// ÉMMISSION
GetData(Table_Envoie[0], "CPU1284", 3x, 1 ,64) // Copie des 64 variables dans la macro
OUTPORT(Table_Envoie[0], "CP340", 64) // Envoie sur le port comm
// RECEPTION
INPORT(response[0], "CP340", 16, retour) // Reception sur le port comm
SetData(retour, "Local HMI", LW, 0, 1) // Retour info communication
if retour > 0 then
Table_Reception[0] = response[1] + (response[0] << 8)
Table_Reception[1] = response[3] + (response[2] << 8)
Table_Reception[2] = response[5] + (response[4] << 8)
Table_Reception[3] = response[7] + (response[6] << 8)
Table_Reception[4] = response[9] + (response[8] << 8)
Table_Reception[5] = response[11] + (response[10] << 8)
Table_Reception[6] = response[13] + (response[12] << 8)
Table_Reception[7] = response[15] + (response[14] << 8)
Table_Reception[8] = response[17] + (response[16] << 8)
Table_Reception[9] = response[19] + (response[18] << 8)
Table_Reception[10] = response[21] + (response[20] << 8)
Table_Reception[11] = response[23] + (response[22] << 8)
Table_Reception[12] = response[25] + (response[24] << 8)
Table_Reception[13] = response[27] + (response[26] << 8)
Table_Reception[14] = response[29] + (response[28] << 8)
Table_Reception[15] = response[31] + (response[30] << 8)
SetData(Table_Reception[0], "CPU1284", 4x, 1 ,16)// Copie des 16 variables dans l'IHM
end if
// TRANSFERT POUR AFFICHAGE
SetData(Table_Reception[0], "Local HMI", LW, 1 ,1) // Puissance Instantané
SetData(Table_Reception[1], "Local HMI", LW, 22 ,1) // Années
SetData(Table_Reception[2], "Local HMI", LW, 21 ,1) // Mois
SetData(Table_Reception[3], "Local HMI", LW, 20 ,1) // Jours
SetData(Table_Reception[4], "Local HMI", LW, 19 ,1) // Heures
SetData(Table_Reception[5], "Local HMI", LW, 18 ,1) // Minutes
SetData(Table_Reception[6], "Local HMI", LW, 17 ,1) // SECondes
SetData(Table_Reception[8], "Local HMI", LW, 2 ,1) // PLC Etat
DELAY(250)
end macro_command
SetData(MotdeVie, "Local HMI", LW, 3, 1) // Retour info communication
J'ai bien mon mot de vie qui incremente sur l'IHM, mais je n'envoie toujours rien sur COM1