Bonjour à tous. Je sais pas si je suis dans la bonne section mais je tente au besoin je redirigerai ;). Actuellement en stage pour valider ma formation de technicien en automatisme.. J'ai pour mission la programmation d'un Ihm PRO FACE sous GP PRO EX. Cet IHM devra communiqué avec un automate déporté de la meme marque ainsi qu'une centrale de mesure IME NEMO D4 DC.. J'auai besoin de votre aide s'il vous plait afin de coder un scrip qui me permetra de recuperer les valeurs de la centrale de mesure. J'ai un debut de code en C mais je n'arrive pas à l'adapter pour le scrip de gp pro.. Si quelqu'un peut m'aiguiller ce serait genial, comme je l'ai precisé au dessus je suis Novice en automatisme et j'ai vraiment besoin de terminé ce projet pour l'obtention de ma certif. Si vous avez besoin d'informations supplémentaire n'hesiter pas.. Je vous transmet dans un premier temps l'ebauche du code que j'ai pu trouvé sur le site ime:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 insigne int calc_crc (char *ptbuf, unsigned int num) /***************************************************************** * Descrizione : calculates a data buffer CRC WORD * Input : ptbuf = pointer to the first byte of the buffer * num = number of bytes * Output : // * Return : ** ***************************************************************/ { unsigned int crc16; unsigned int temp; unsigned char c, flag; crc16 = 0xffff; /* init the CRC WORD */ for (num; num>0; num--) { temp = (unsigned int) *ptbuf; /* temp has the first byte */ temp &= 0x00ff; /* mask the MSB */ crc16 = crc16 ^ temp; /* crc16 XOR with temp */ for (c=0; c<8; c++) { flag = crc16 & 0x01; /* LSBit di crc16 is mantained */ crc16 = crc16 >> 1; /* Lsbit di crc16 is lost */ if (flag != 0) crc16 = crc16 ^ 0x0a001; /* crc16 XOR with 0x0a001 */ } ptbuf++; /* pointer to the next byte */ } crc16 = (crc16 >> 8) | (crc16 << 8); /* LSB is exchanged with MSB */ return (crc16); } /* calc_crc */
Voili voilou.; Je bloque complet si y a une ame charitable pour me sortir du brouillard svp ^^ en sachant que l'ihm me renvoie n code erreur qui est le suivant:Address Byte n. Description Unit 0x1000 4 Voltage mV 0x1002 4 Current mA 0x1004 4 Signed power (*) 0x1006 4 Positive Energy Wh 0x1008 4 Negative Energy Wh 0x100A 4 Time seconds 0x100C 4 Average Power (*) 0x100E 4 Maximum Power Demand (*) 0x1010 2 Minutes elapsed durino theaverage calculation 0x1012 4 Positive Amperehours Ah 0x1014 4 Negative Amperehours Ah 0x1201 WORD Current transformer ratio (KTA) integer 0x1202 WORD Voltage transformer ratio (KTV) 1/10 0x1203 WORD Device identifier 0x14
Merci à tous. CordialementCitation:
RHAA036 Error has been responded for device read Command ( Error code 2[2H] There are out of range devices)