The
AT command +CMGF (command name in text: Message Format) is used to
select the operating mode of the GSM/GPRS modem or mobile phone. It
takes one parameter. The value of the parameter can either be 0 or 1.
The values 0 and 1 refer to SMS PDU mode and SMS text mode
respectively. SMS PDU mode is the default mode if it is implemented
on the mobile device.
To
find out the operating mode(s) supported by a GSM/GPRS modem or
mobile phone, perform a test operation with the +CMGF AT command.
Below shows the response returned from my Nokia 6021 mobile phone
after the execution of the command line "AT+CMGF=?":
AT+CMGF=? +CMGF:
(0,1)
OK
The
information response "+CMGF: (0,1)" indicates Nokia 6021
supports both PDU mode and text mode.
To
change the operating mode of a GSM/GPRS modem or mobile phone,
perform a set operation with the +CMGF AT command. The following
example demonstrates how to set the operating mode to SMS text mode:
AT+CMGF=1 OK
If
the operating mode specified is not supported by the GSM/GPRS modem
or mobile phone, the final result code "ERROR" will be
returned.
To
find out the operating mode currently used by a GSM/GPRS modem or
mobile phone, perform a read operation with the +CMGF AT command.
Here is an example:
AT+CMGF? +CMGF:
0
OK
The
response above indicates the GSM/GPRS modem or mobile phone is using
SMS PDU mode.