I have made the following circuit where I have interface RFID and GSM with atmega16 using a MUX.
During simulation, I am getting "Logic contention detected " at T1out and T2out. I am unable to understand the error here.
can someone explain the error.
It happens if pins are configured as inputs and used for outputs. Configure UART Tx as output pin and Rx as input pin using DDRx register.
Zip and post complete project files.
Remove MAX232 from Proteus Schematic. You don't need it in Proteus. Connect COMPIM pins directly to AVRs UART pins through your MUX. In your code there is no code related to baudrate setting.
Also in the USART ISR Compiler shows variable value in blue. It seems it is a reserved keywork. So, change the variable value's name to some other thing.
Remove VT if COMPIM is used. Try attached project. Load my Proteus file and type in GSM VT (Virtual Terminal). It will Echo in ECHO VT. You had set DDRB to 0x00 and so PORTB was all input. PORTB.0 had to be output type to select MUX channel. Load proper .hex file from project debug folder.
What are you trying to do ? Do you want to control some device using GSM if RFID tag matches with TAG stored in MCU ? If yes then you don't need MUX. You connect RFID out to AVR UART RxD and GSM UART Rx to AVR UART TxD. This way when a RDIF TAG match occurs then AVR sends out SMS thtough GSM. If you want to read SMS using AVR then you need MUX or bi-lateral switch.