Im having problems comunicating to this sim modem.
Works Ok if I just send a cmd via console and read bytes back.
If I try to use strings to capture the reply it just locks up.
I know it my programming capabilties

Ive tried all sorts of ways to do it but not with any success.
Any help would be appreciated . Thanks
Hers my code below
- Code: Select all
' Imports section...
' Declarations...
' import Uart modules...
imports Uart
imports Uart2
Imports Strings
' main program entry point...
Sub Main()
Uart.SetBaudrate(Uart.Baudrate.Is38400)
Uart2.SetBaudrate(Uart2.Baudrate.Is4800)
Uart.ReadTerminator = 13
dim command as string
dim number1 as string
dim b as string(256)
dim nxtStr as ushort = 0
dim data as byte = 0
Uart2.Write("AT",13,10)
'Uart2.Write("ATEO",13,10)
'Uart2.Write("AT+CVHU=0",13,10)
'Uart2.Write("AT+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22,13,10)
' Uart.Write("AT+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22,13)
while true
nxtStr = 0
data = 0
if uart.DataAvailable then
Uart.Read(command)
'Uart2.Write("AT+CPMS=",$22,"SM",$22,",",$22,"SM",$22,",",$22,"SM",$22,13,10)
Uart2.Write(command,13,10)
end if
delayms(100)
if Uart2.DataAvailable then
'Console.Write("data here")
do
data = Uart2.Readbyte()
b(nxtStr) = data
nxtStr += 1
loop until data = 13
'Uart.WriteByte(Uart2.ReadByte())
Console.Write("reply is ",b)
'uart2.read(number1)
'Uart.Write(number1,13,10)
end if
end while
End Sub