-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstatus_plc.c
More file actions
38 lines (25 loc) · 726 Bytes
/
Copy pathstatus_plc.c
File metadata and controls
38 lines (25 loc) · 726 Bytes
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
32
33
34
35
36
37
38
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <malloc.h>
#include "comm.h"
#include "hostlink.h"
#include "models.h"
int main(void)
{
p_port COM5;
p_plc cpm1;
int resposta;
COM5 = defineix_port("/dev/ttyS10",B9600, CS7 | CSTOPB | PARENB);
cpm1 = designa_plc(0x11,0);
obre_port(COM5);
printf("Port obert..\n");
envia_comanda(COM5,"@00MM40*\r");
rebre_comanda(COM5);
printf("Rebuda la resposta: %10s\n",in_buffer(COM5));
printf("Comanda interpretada: %d\n",que_es(in_buffer(COM5)));
printf("Comprovant comanda: %d\n",comprova_comanda(cpm1,in_buffer(COM5)));
tanca_port(COM5);
// free(cpm1);
free(COM5);
}