-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from InnoGreenTech/triphase_historique
base triphase historique
- Loading branch information
Showing
3 changed files
with
194 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
int i=0; | ||
|
||
|
||
void setup() { | ||
Serial.begin(1200,SERIAL_7E1); | ||
//Serial.begin(9600); | ||
|
||
} | ||
|
||
void loop() { | ||
|
||
|
||
if (i==20){ | ||
|
||
Serial.print(trame_historique("ADCO", "123456789012")); | ||
delay(13); | ||
Serial.print(trame_historique("OPTARIF", "BASE")); | ||
delay(13); | ||
Serial.print(trame_historique("ISOUSC", "60")); | ||
delay(13); | ||
Serial.print(trame_historique("BASE", "000015000")); | ||
delay(13); | ||
Serial.print(trame_historique("PETC", "TH12")); | ||
delay(13); | ||
Serial.print(trame_historique("IINST1", "012")); | ||
delay(13); | ||
Serial.print(trame_historique("IINST2", "014")); | ||
delay(13); | ||
Serial.print(trame_historique("IINST3", "013")); | ||
delay(13); | ||
Serial.print(trame_historique("IMAX1", "060")); | ||
delay(13); | ||
Serial.print(trame_historique("IMAX2", "060")); | ||
delay(13); | ||
Serial.print(trame_historique("IMAX3", "060")); | ||
delay(13); | ||
Serial.print(trame_historique("PMAX", "09000")); | ||
delay(13); | ||
Serial.print(trame_historique("PAPP", "00700")); | ||
delay(13); | ||
Serial.print(trame_historique("HHPHC", "A")); | ||
delay(13); | ||
Serial.print(trame_historique("MOTDETAE", "000000")); | ||
delay(13); | ||
Serial.print(trame_historique("PPOT", "00")); | ||
i=0; | ||
} | ||
|
||
delay(33); | ||
Serial.print(trame_historique("ADIR1", "005")); | ||
delay(13); | ||
Serial.print(trame_historique("ADIR2", "003")); | ||
delay(13); | ||
Serial.print(trame_historique("ADIR3", "004")); | ||
delay(13); | ||
Serial.print(trame_historique("ADCO", "123456789012")); | ||
delay(13); | ||
Serial.print(trame_historique("IINST1", "034")); | ||
delay(13); | ||
Serial.print(trame_historique("IINST2", "028")); | ||
delay(13); | ||
Serial.print(trame_historique("IINST3", "053")); | ||
|
||
|
||
|
||
|
||
delay(33); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
String trame_historique(char *etiquette, char *donnee ){ | ||
|
||
String trame=""; | ||
String information=""; | ||
|
||
|
||
information = etiquette; | ||
information += char(0x20); | ||
information += donnee; | ||
|
||
|
||
int lengh = information.length(); | ||
|
||
char checksum=0; | ||
for (int i=0; i<lengh; i++) | ||
{ | ||
checksum = checksum + char(information[i]); | ||
} | ||
checksum = (checksum & 0x3F) + 0x20; | ||
trame=char(0x0A); | ||
trame+=information; | ||
trame+=char(0x20); | ||
trame+=char(checksum); | ||
trame+=char(0x0D); | ||
|
||
return trame; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters