Reputation: 15
I am working with my MULTIBAND 900E 1800 WAVECOM MODEM. I have created a project using .Net C# to communicate with my modem by AT-Command. But I am not getting any Human readable response from the modem. The response is like that -
'P&ØPP&ØÐPØØPØØþRÏÐÿÔ'
I am unable to decode the response so that I can understand.
I have tried by changing the serial port Encoding using:
port.Encoding = Encoding.ASCII;
port.Encoding = Encoding.UTF8;
port.Encoding = Encoding.GetEncoding("ISO-8859-1");
Using the different encoding the response gets changed but still in unreadable character.
Besides, I have tried by changing CSCS:
AT+CSCS=GSM
AT+CSCS=UCS2
AT+CSCS=HEX
AT+CSCS="8859-1"
Using the different CSCS the response gets changed but still in unreadable character.
port = new SerialPort(SERIAL_PORT_NAME)
{
BaudRate = 9600,
DataBits = 8,
Parity = Parity.None,
StopBits = StopBits.One
};
port.Parity = Parity.None;
port.ReadTimeout = 300;
port.WriteTimeout = 300;
//port.Encoding = Encoding.UTF8;
//port.Encoding = Encoding.GetEncoding("ISO-8859-1");
port.DtrEnable = true;
port.RtsEnable = true;
port.Open();
//port.WriteLine("AT+CSCS=GSM");
//response = port.ReadExisting();
port.WriteLine("AT");
response = port.ReadExisting();
If I write AT the modem should response OK. That's exactly happening while I am trying to test my modem using https://m2msupport.net/m2msupport/ussd-how-to-send-ussd-short-codes-with-at-command/. But each and every application or sample code I found that made using .Net have the same issue.
Upvotes: 1
Views: 321
Reputation: 7490
As far as I understand you are able to send AT commands using a common terminal but you fail doing it programmatically.
My suggestion is the following checklist:
Verify (1) and (2) with your terminal before choosing your settings in code.
<CR>
char (ASCII 0x0D
). Are you sure that WriteLine
is terminated by <CR>
and not <LF>
? Probably using Port.Write("AT\r")
would be a better choice.Upvotes: 2