Thanks so much for your reply.
But here there is one problem.Suppose that i made screens in HMI.and i want to read status of one button in the second screen.
What is the the data the will be send to HMI and what is the answer?Can you give me a example?
Also I don't know anything about MODBUS.As far as i know,avr is just only has RXD and TXD in TTL logic.
How we are able to change this logic to MODBUS.
In ModBUS one configure each configure each Control variable(e.g Button) to user defined memory address in HMI.To read Status from salve Node you specify that address and command( Read Or Write in Modbus) in modbus Packet.Free moodbus stack is available athttp://www.freemodbus.org/index.php?idx=2
Regarding hardware,If your HMI has RS232 Support than MAX232 will do,for RS485 one have to use MAX485.and if Your HMI has ethernet port than have to use Network Interface Controller(NIC) like
ENC28J60 and require MODBUS over Ethernet Protocol
Hope this will help