This shows you the differences between two versions of the page.
| — | comfilehmi:exampe_projects:index [2026/02/20 15:37] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== FADUINO Sample Applications ====== | ||
| + | |||
| + | This example use Simple-Modbus library developed by Comfile Technology. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | The example below was created using FA-DUINO-32TA. | ||
| + | ===== Interfacing with an FADUINO (Digital IO) ===== | ||
| + | |||
| + | This project illustrates how to use a ComfileHMI to monitor and control an [[https:// | ||
| + | |||
| + | < | ||
| + | < | ||
| + | <iframe width=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | {{ : | ||
| + | |||
| + | <code c> | ||
| + | |||
| + | #include " | ||
| + | |||
| + | 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); | ||
| + | startSimpleModbus(1, | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | int n; | ||
| + | for(n=0; n<8; n++){ bitWrite(au8data[0] ,n, digitalRead(n+22)) ;} // | ||
| + | for(n=0; n<8; n++){ bitWrite(au8data[1], | ||
| + | | ||
| + | for(n=0; n<8; n++){ digitalWrite(38+n, | ||
| + | for(n=0; n<8; n++){ digitalWrite(46+n, | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Interfacing with an FADUINO (Analog IO) ===== | ||
| + | |||
| + | This project illustrates how to use a ComfileHMI to monitor and control an [[https:// | ||
| + | |||
| + | < | ||
| + | < | ||
| + | <iframe width=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | {{ : | ||
| + | |||
| + | |||
| + | <code c> | ||
| + | |||
| + | #include < | ||
| + | |||
| + | uint16_t au16data[16]; | ||
| + | uint8_t au8data[10]; | ||
| + | int pwm6 = 6; | ||
| + | int pwm7 = 7; | ||
| + | int incomingByte = 0; | ||
| + | |||
| + | void setup() { | ||
| + | char i; | ||
| + | pinMode(pwm6, | ||
| + | pinMode(pwm7, | ||
| + | |||
| + | Serial3.begin(57600); | ||
| + | usart1init(57600); | ||
| + | startSimpleModbus(1, | ||
| + | } | ||
| + | |||
| + | 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, | ||
| + | analogWrite(pwm7, | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | [[comfilehmi: | ||
| + | |||