This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
comfilehmi:exampe_projects:index [2023/06/30 05:42] COMFILE Technology [Repeated Action When Button Held] |
comfilehmi:exampe_projects:index [2023/10/23 13:57] (current) COMFILE Technology |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Example Projects ====== | + | ====== FADUINO Sample Applications ====== |
+ | This example use Simple-Modbus library developed by Comfile Technology. | ||
+ | |||
+ | {{ :comfilehmi:exampe_projects:simplemodbusrtu_mega2560.zip |}} | ||
+ | |||
+ | The example below was created using FA-DUINO-32TA. | ||
===== Interfacing with an FADUINO (Digital IO) ===== | ===== Interfacing with an FADUINO (Digital IO) ===== | ||
Line 16: | Line 21: | ||
{{ :comfilehmi:exampe_projects:faduino_test_arduino.zip | Download FADUINO Source Code}} | {{ :comfilehmi:exampe_projects:faduino_test_arduino.zip | Download FADUINO Source Code}} | ||
+ | <code c> | ||
+ | |||
+ | #include "SimpleModbusRtu_mega2560.h" | ||
+ | |||
+ | uint16_t au16data[16]; | ||
+ | uint8_t au8data[10]; | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | int i; | ||
+ | for(i=22; i<38; i++){ pinMode(i, INPUT); } // 22 ~ 37 Inputs | ||
+ | for(i=38; i<52; i++){ pinMode(i, OUTPUT); } // 38 ~ 51 Outputs | ||
+ | |||
+ | Serial.begin(9600); | ||
+ | |||
+ | usart1init(57600); // 9600, 19200, 38400, 57600 , Serial channel1 | ||
+ | startSimpleModbus(1, au16data, au8data); // slave address, register, coil | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | int n; | ||
+ | for(n=0; n<8; n++){ bitWrite(au8data[0] ,n, digitalRead(n+22)) ;} //Input | ||
+ | for(n=0; n<8; n++){ bitWrite(au8data[1], n, digitalRead(n+30)) ;} | ||
+ | | ||
+ | for(n=0; n<8; n++){ digitalWrite(38+n, bitRead(au8data[2], n)) ;} // Output | ||
+ | for(n=0; n<8; n++){ digitalWrite(46+n, bitRead(au8data[3], n)) ;} | ||
+ | } | ||
+ | |||
+ | </code> | ||
===== Interfacing with an FADUINO (Analog IO) ===== | ===== Interfacing with an FADUINO (Analog IO) ===== | ||
Line 31: | Line 66: | ||
{{ :comfilehmi:exampe_projects:faduino_test_analog.zip | Download ComfileHMI Project}}\\ | {{ :comfilehmi:exampe_projects:faduino_test_analog.zip | Download ComfileHMI Project}}\\ | ||
{{ :comfilehmi:exampe_projects:faduino_test_analog_arduino.zip | Download FADUINO Source Code}} | {{ :comfilehmi:exampe_projects:faduino_test_analog_arduino.zip | Download FADUINO Source Code}} | ||
- | |||
- | ===== Set Date And Time ===== | ||
- | |||
- | Use the keypad to set the date and time. | ||
- | |||
- | {{ :comfilehmi:exampe_projects:setrtc.png?600 }} | ||
- | |||
- | |||
- | {{:comfilehmi:exampe_projects:setrtc.zip | Download}} | ||
- | |||
- | ===== Input Password ===== | ||
- | |||
- | Authenticate access to a screen. | ||
- | |||
- | {{ :comfilehmi:exampe_projects:password.png?600 }} | ||
- | |||
- | {{ :comfilehmi:exampe_projects:password.zip | Download}} | ||
- | |||
- | ===== MSB642RA-DC I/O ===== | ||
- | |||
- | Control and monitor I/O from a MSB624RA. | ||
- | |||
- | {{ :comfilehmi:exampe_projects:msbtest.png?600 }} | ||
- | |||
- | {{ :comfilehmi:exampe_projects:hmi_test.zip | Download HMI Project}} | ||
- | |||
- | {{ :comfilehmi:exampe_projects:msb_test.zip | Download MSB Project}} | ||
- | ===== Screensaver ===== | + | <code c> |
- | Implementation of a screensaver feature. | + | #include <SimpleModbusRtu_mega2560.h> |
- | {{ :comfilehmi:exampe_projects:screensaver.png?600 }} | + | uint16_t au16data[16]; |
+ | uint8_t au8data[10]; | ||
+ | int pwm6 = 6; | ||
+ | int pwm7 = 7; | ||
+ | int incomingByte = 0; | ||
- | {{ :comfilehmi:exampe_projects:screensaver.zip | Download}} | + | void setup() { |
+ | char i; | ||
+ | pinMode(pwm6, OUTPUT); | ||
+ | pinMode(pwm7, OUTPUT); | ||
- | ===== Trackbar Widget ===== | + | Serial3.begin(57600); |
+ | usart1init(57600); // 9600, 19200, 38400, 57600 , Serial channel1 | ||
+ | startSimpleModbus(1,au16data, au8data); // slave address, register, coil | ||
+ | } | ||
- | The position of the arrow will change according to the value read from the PLC. | + | void loop() |
+ | { | ||
+ | au16data[0] = analogRead(A0); | ||
+ | au16data[1] = analogRead(A1); | ||
+ | au16data[2] = analogRead(A2); | ||
+ | au16data[3] = analogRead(A3); | ||
+ | au16data[4] = analogRead(A4); | ||
+ | au16data[5] = analogRead(A5); | ||
+ | au16data[6] = analogRead(A6); | ||
+ | au16data[7] = analogRead(A7); | ||
+ | analogWrite(pwm6, au16data[8]); | ||
+ | analogWrite(pwm7, au16data[9]); | ||
+ | } | ||
- | {{ :comfilehmi:exampe_projects:arrow.png?600 }} | + | </code> |
- | {{ :comfilehmi:exampe_projects:arrow.zip | Download}} | + | [[comfilehmi:index|ComfileHMI - Human Machine Interface (HMI) Development Kit]] |