First of all I worked on hardware. I used Arduino Duimilanove and ethernet shield. I developed the code on this hardware prototype.
ADM2484 IC was used as RS485 transreceiver IC.
Arduino needs to do many works like:
1.Getting pressure reading from anther arduino system through ethernet
2. Process the data and calculating output frequency for each VFD by implementing PID.
3. Driving the VFDs with this new frequency using MODBUS over RS485.
4. Meanwhile if GUI asks for informatin then it has to send data packets to the GUI over ethernet.
To perform these many functions, the code needs to be free from polling the resources. So I decided to keep all the communications interrupt based.
The ethernet libraries for arduino are polling based and we need to check fr the received data regularly. To make use of interrupt capability of ethernet shield, you need to short INT jumper of ethernet shield.
1. I implemented MODBUS protocol on my own. Please note, for this I did not use inbuilt serial library as I wanted to control the serial receiver interrupt on my own. With USART RX ISR, I can monitor each byte and can process the data more faster as compared to polling method that would have required for inbuilt serial library.
2. While implementing UDP protocol, I needed to poll the UDP RX buffer to check the received data and thus it was taking a lot to respond to the information requested by the GUI. So I implemented interrupt based ethernet communication. Interrupts for all sockets has been enabled.
Finally I had the working prototype ready. Next step was to get everything on the same PCB.