Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

connection between CR1000 & COM11 (sending AT commands to modem)


Hector Apr 28, 2017 08:20 AM

Hello,

so it's been some few weeks since I begun working with Dataloggers and modems, and i learnt many things till now.

But my objective right now is to establish a connection between the modem ( COM111) and the CR1000 using the RS232 port to try sending AT Commands to the modem and retrieve the answers returned when applying these AT Commands( knowing that the Datalogger is connected to the Computer using the CS I/O port.)

so i know that many options exists to establish a connection between the COM111 and the CR1000, by using the TCP/IP , or a PPP connection .

however i'm not that good yet in both of these methods, so i tried  writing a CRBasic code to test and see what happens. but i found myself stuck because i'm lacking many variables; such as the modem IP (that i can't get hold of)  and the port to use in the serialin or serialout functions.

what i need is a method or a configuration that allows me to send my AT command 

thank you!

here is  my code

 

Public table1(10)
Public CSQ As String * 48
Public status As Boolean
Public CREG As String * 48
Public ConfigurationChecksum
Public ConfigurationChecksumMemory

ConstTable
'Modem'
Const GSM_ModemBaudRate=9600
Const GSM_ModemPort=ComME
Const GSM_CR=CHR(13)
Const GSM_OK=CHR(10)& "OK"
EndConstTable

DataTable (Donnees,1,-1)
DataInterval (0,10,min,10)
Sample (1,CSQ,String)
FieldNames ("AT+CSQ")
Sample (1,CREG,String)
FieldNames ("AT+CREG")
EndTable


BeginProg


'slave ModBus for port RS232'
ModBusSlave (ComRS232,-9600,99,r_modbus(),status)

'slave ModBus for TCP/IP'
ModBusSlave (502,-9600,1,r_modbus(),status)

'Open a port modem to control CSQ CREG, change the SC105 "Modem"
SerialOpen(ComME,9600,0,0,10000)
ConfigurationChecksum=0
ConfigurationChecksumMemory=1


SlowSequence
Scan (10,sec,3,0)
'PPPClose
Delay(1,10,sec)
SerialOut(GSM_ModemPort,"AT+CSQ" & GSM_CR,"+CSQ: ",1,200)
SerialIn (CSQ,GSM_ModemPort,200,GSM_CR,2)
SerialOut(GSM_ModemPort,"AT+CREG?" & GSM_CR,"+CREG: ",1,200)
SerialIn (CREG,GSM_ModemPort,200,CHR(10),4)
'SerialClose(GSM_ModemPort)'
'PPPOpen'''
CallTable Donnees

NextScan

EndProg


aps Apr 28, 2017 01:48 PM

The general techniques you are using should work but you should note that by defualt we normally set the COM111 to 115200 baud, if used for PPP.   Also your slow sequence runs every 10 secs and has a delay of 10 s, so will skip scans plus there will never be any chance of a PPP session opening.


Hector Apr 28, 2017 03:59 PM

ok, so aside from the PPP connection , i'm more for using the RS232 port, however when i run the program using device Config. utility, on the Data monitor tab , there is no results from the At Command, does it mean that there is no connection between the modem and the Datalogger( then it's normal that i have no results from the AT Commands) or do i need to do a different configuration before running my program to establish a link between them.  

Log in or register to post/reply in the forum.