CRBasic Example 3: CELL200 series settings configuration and status retrieval using terminal
functionality
SerialFlush
(ComSDC11)
SerialOut
(ComSDC11,
"show usage today"
& CRLF, CRLF, 1, 200)
'Query for today's cellular data usage
SerialIn
(returned_value, ComSDC11, 100,
CHR
(13), 1000)
modem_current_day_usage = returned_value
SerialFlush
(ComSDC11)
SerialOut
(ComSDC11,
"show usage yesterday"
& CRLF, CRLF, 1, 200)
'Query for yesterday's cellular data usage
SerialIn
(returned_value, ComSDC11, 100,
CHR
(13), 1000)
modem_previous_day_usage = returned_value
SerialFlush
(ComSDC11)
SerialOut
(ComSDC11,
"show usage month"
& CRLF, CRLF, 1, 200)
'Query for this month's cellular data usage
SerialIn
(returned_value, ComSDC11, 100,
CHR
(13), 1000)
modem_current_month_usage = returned_value
SerialFlush
(ComSDC11)
SerialOut
(ComSDC11,
"show usage lastmonth"
& CRLF, CRLF, 1, 200)
'Query for last month's cellular data usage
SerialIn
(returned_value, ComSDC11, 100,
CHR
(13), 1000)
modem_previous_month_usage = returned_value
SerialFlush
(ComSDC11)
SerialOut
(ComSDC11,
"show bat"
& CRLF, CRLF, 1, 200)
'Query for last month's cellular data usage
SerialIn
(returned_value, ComSDC11, 100,
CHR
(13), 1000)
modem_battery_voltage = returned_value
CallTable
CELL_DIAGNOSTICS
NextScan
EndSequence
SlowSequence
Do
Delay
(1, 5, Sec)
If(TimeIsBetween
(10, 58, 60, Min)
AND
modem_is_off <> TRUE)
Then
'make sure the modem is off at 10 minutes into
'the hour until 58 minutes into the hour
'PPPClose'Uncomment line for CR1000, CR800 series, and CR3000.
Do Until
(modem_is_off = TRUE)
SerialFlush
(ComSDC11)
'clean out any garbage characters that might have come in.
SerialOut
(ComSDC11, CRLF ,
"CELL2xx>"
, 1, 200)
CELL200-Series 4G LTE Cellular Module
71