Internet PLC Forum

General => Technical support => Topic started by: kizor on August 17, 2008, 12:38:39 PM

Title: split print# command in different lines
Post by: kizor on August 17, 2008, 12:38:39 PM
hi

Ihave a custom function that trigger a print#1 command to send out a sms with the date and time of a event via a gsm modem.

example:
PRINT #1 "at+cmgs=phonenumber" "event"+str$(date[3])+"/"+str$(date[2])+"/"+str$(date[1])+"      at    "+STR$(TIME[1])+":"+STR$(TIME[2])+":"+STR$(time[3])

Is it possible to sent this out in 4 lines instead of 1 so that I become a sms as following

event
date
at
time

thanks in advance
Title: Re:split print# command in different lines
Post by: support on August 18, 2008, 05:16:05 PM
Do you mean the following:

PRINT #1 "at+cmgs=phonenumber"
PRINT #1 "event"
PRINT #1  str$(date[3])+"/"+str$(date[2])+"/"+str$(date[1])
PRINT #1"      at    "
PRINT #1 STR$(TIME[1])+":"+STR$(TIME[2])+":"+STR$(time[3])

Yeah it should work.
Title: Re:split print# command in different lines
Post by: kizor on August 19, 2008, 04:16:37 AM
Yes I have tray this  and it seem to work in simulation but it d'doesnt work when transfer to plc .

 To send out a sms,I may only use once the print# command because everything must send out in one go.

Is it possible to send it out so I become a sms with text in 4 lines


Thanks in advance
Title: Re:split print# command in different lines
Post by: support on August 20, 2008, 07:29:54 AM
Does your SMS accept CR character (ASCII 13) as a terminator of the message or line separation? If CR characters is a terminator then you probably can't break out your message into 4 lines. If newline character (ASCII 10) can be used to break message into lines then you can try the following"

PRINT #1 "at+cmgs=phonenumber\0A";
PRINT #1 "event\0A";
PRINT #1  str$(date[3])+"/"+str$(date[2])+"/"+str$(date[1])+"\0A";
PRINT #1"      at \0A";
PRINT #1 STR$(TIME[1])+":"+STR$(TIME[2])+":"+STR$(time[3])

I don't know if it would work on your sms. But the above would send out everything in a single string and contains new line character "\0A" (Hex value of 10).