Comfiletechnology / Mbed 2 deprecated 2-ComfileHMI_Modbus

Dependencies:   mbed

Fork of 2-ComfileHMI_Modbus by Comfiletechnology

Committer:
hyx2001
Date:
Mon Sep 12 09:31:11 2016 +0000
Revision:
4:217cca9f2592
Parent:
3:f234e151b888
ComfileHMI_Modbus

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 0:023c5cda6102 1
4180_1 0:023c5cda6102 2 #include "mbed.h"
hyx2001 2:f0fc57045b3d 3 #include "SimpleModbus.h"
4180_1 0:023c5cda6102 4
hyx2001 4:217cca9f2592 5 static u8 MDcoil[100];
hyx2001 4:217cca9f2592 6 static u16 MDregister[100];
hyx2001 4:217cca9f2592 7
hyx2001 4:217cca9f2592 8 BusInOut LED(PC_0,PC_1,PC_2,PC_3,PC_4,PC_5,PC_6,PC_7);
hyx2001 4:217cca9f2592 9 BusInOut SWITCH(PB_0,PB_1,PB_2,PB_3,PA_9,PA_10,PA_11,PA_12);
hyx2001 4:217cca9f2592 10 AnalogIn ADIN0(PA_0);
hyx2001 4:217cca9f2592 11 AnalogIn ADIN1(PA_1);
hyx2001 4:217cca9f2592 12
4180_1 0:023c5cda6102 13
4180_1 0:023c5cda6102 14 int main() {
hyx2001 2:f0fc57045b3d 15 StartModbus(PC_10, PC_11, 115200, 1, MDregister, MDcoil);
hyx2001 4:217cca9f2592 16 LED.output();
hyx2001 4:217cca9f2592 17 SWITCH.input();
4180_1 0:023c5cda6102 18
4180_1 0:023c5cda6102 19 while (1) {
hyx2001 4:217cca9f2592 20 wait_ms(50);
hyx2001 4:217cca9f2592 21 LED = MDcoil[0];
hyx2001 4:217cca9f2592 22 MDcoil[1] = SWITCH;
hyx2001 4:217cca9f2592 23 MDregister[0] = ADIN0.read_u16();
hyx2001 4:217cca9f2592 24 MDregister[1] = ADIN1.read_u16();
4180_1 0:023c5cda6102 25 }
4180_1 0:023c5cda6102 26 }
4180_1 0:023c5cda6102 27