The Philippine Electronics and Technology Forum
May 17, 2012, 06:34:23 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 27   Go Down
  Print  
Author Topic: Globe Tattoo USB Modem in VB6, finally..  (Read 16766 times)
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« on: August 27, 2010, 11:18:18 PM »

        I have finally created a vb6 mini prog to read a received mssg using Globe Tattoo's USB modem.  Grin Grin Thanks to master 7 and to master emond. Malayo pa ito sa tapos. It just fulfilled a very basic purpose, that is, it just displays the received mssg and can send a single text. But sa tingin ko it could be easily edited to suit other purposes (i hope).

   I know matawa kaau sa codes ko, noob pa talaga ako sa programming, sa school hindi talaga kami tinuruan. Mga master please let me know naman if mayroon mga dapat talagang baguhin sa codes ko. I obviously still needs to learn to use loops to optimize the way i code and also more importantly about buffers. And i have also the problem of storing the mscomm.input on a string that is why i still use the TextBox1 (which is obviously not necessary). I know that the way i use the timer is not so appropriate, but its the only way i know to constantly check something. I tried to search on google about AT+CNMA and AT+CNMI but I didnt find something useful.

   Bottom line, im still a beginner. But nevertheless i still hopes someone out there who is also a beginner may find this codes somewhat useful. I have included a command to check my balance because it is the only way I could send a text and receive a mssg even without a load.


Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim str1, str2, str3 As String
Dim lngPos1, lngPos2 As Integer
Dim strInput As String
Dim msgcheck As Variant
Option Explicit

Private Sub getmssg()
lngPos1 = InStrRev(Text1.Text, "32")    ' Usually there is a "32" near the start of the actual mssg and the mssg
lngPos1 = lngPos1 + 5                        ' usually ends with "OK"( response of the modem). Therefore the mssg must
lngPos2 = InStrRev(Text1.Text, "OK")   ' not contain a "32" or "OK". You could replace "32" with "X" or a symbol
lngPos2 = lngPos2 - 4                         ' like # if the mssg is expected to have an "X" or a symbol #. Other
lngPos2 = lngPos2 - lngPos1                ' symbols may also be used.
Text3.Text = Mid$(Text1.Text, lngPos1, lngPos2)
End Sub

Private Sub erazemssg()
Sleep 300
str1 = "AT+CMGD = 0"
MSComm1.Output = str1 & vbCr
End Sub

Private Sub viewmssg()
str1 = "AT+CMGR= 0"                         ' view the latest mssg recivd
MSComm1.Output = str1 & vbCr
End Sub

Private Sub Command1_Click()
erazemssg
Text3.Text = vbNullString
End Sub

Private Sub Command2_Click()
erazemssg
Unload Me
End Sub

Private Sub Command3_Click()
' Send an 'AT' command to the phone
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGS=" & Chr(34) & 222 & Chr(34) & vbCrLf
Sleep 800
MSComm1.Output = "BAL" & Chr(26)
Sleep 2000
Sleep 1500
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
End Sub

Private Sub Command4_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
MSComm1.Output = "AT+CMGS=" & Chr(34) & Text4.Text & Chr(34) & vbCrLf
Sleep 1000
MSComm1.Output = Text2.Text & Chr(26)
Sleep 4000
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End Sub

Private Sub Form_Load()
With MSComm1
'make sure the serial port is not open (by this program)
If .PortOpen Then .PortOpen = False
'set the active serial port
.CommPort = 5
'set the badurate,parity,databits,stopbits for the connection
.Settings = "9600,N,8,1"
'set the DRT and RTS flags
.DTREnable = True
.RTSEnable = True
'enable the oncomm event for every reveived character
.RThreshold = 1
'disable the oncomm event for send characters
.SThreshold = 0
'open the serial port
.PortOpen = True
End With
End Sub

Private Sub MSComm1_OnComm()
Text1.Text = ""
With MSComm1
'test for incoming event
Select Case .CommEvent
Case comEvReceive
'display incoming event data to displaying textbox
strInput = .Input
Text1.SelText = strInput
End Select
End With
End Sub

Private Sub Timer1_Timer()           'check for mssg every .4sec
viewmssg
str3 = Mid$(Text1.Text, 3, 6)
If str3 = "+CMGR:" Then
Beep
getmssg                              'displays the recivd mssg
erazemssg
End If
End Sub


'-----------end of Code---------------------


It can be downloaded here:
http://rapidshare.com/files/415468861/SendReciv_Vb6.zip Cheesy
Logged
The Philippine Electronics and Technology Forum
« on: August 27, 2010, 11:18:18 PM »

 Logged
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #1 on: August 28, 2010, 07:23:53 PM »

Ito pala ang tama, kasi sometimes may "32" sa time or sa telephone number. Grin

Code:
lngPos1 = InStrRev(Text1.Text, "+32")   
lngPos1 = lngPos1 + 6     


Logged
The Philippine Electronics and Technology Forum
« Reply #1 on: August 28, 2010, 07:23:53 PM »

 Logged
maldihtah13
Technical People
Nuclear Reactor
*****

Pogi/Ganda Points: 114
Offline Offline

Gender: Female
Posts: 4499


Everyday is a learning process so try to learn ;D


WWW
« Reply #2 on: August 28, 2010, 10:31:22 PM »

Nice man.

If you like we can rewrite it in VB 2010.

BTW, what's your application for this.
Logged
The Philippine Electronics and Technology Forum
« Reply #2 on: August 28, 2010, 10:31:22 PM »

 Logged
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #3 on: August 28, 2010, 11:16:23 PM »

If you like we can rewrite it in VB 2010.
That would be great sir, since vb6 is almost obsolete. Thanks in advance.I'm still downloading VB 2010, and it would take some time because its a large file and i only have 50kb/s download speed.

BTW, what's your application for this.

  I still don't have a specific application for this sir. But if i have the time, i could include it for my final thesis. My thesis title is "Switching Appliances Remotely Using Power Line Communications". I will built a system which will constantly check if some electrically-wasteful appliances are left turned on without anybody using it. Then the user could turned it off if desired. Power saving is my main objective.
  There would be one central station which is connected to a PC. And there would be multiple receivers (appliances monitored). This topic is already approved. But if I have the time I would make it SMS-controlled. So I would just text the central station to find out the condition of the appliances, the central station would then send a reply then i finally i would send a text that would turned on/off the appliances. Would that be OK sir? Maraming salamat sir..  Smiley
Logged
maldihtah13
Technical People
Nuclear Reactor
*****

Pogi/Ganda Points: 114
Offline Offline

Gender: Female
Posts: 4499


Everyday is a learning process so try to learn ;D


WWW
« Reply #4 on: August 29, 2010, 11:29:29 AM »

My thesis title is "Switching Appliances Remotely Using Power Line Communications".

Medyo madugo ang Power Line Communication kasi yung installed equipment nga dito sa planta hanggang ngayun di pa rin magawagawa. Equipment alone cost so much. Filters involved are so big since it is installed in the switch yard.
Logged
Kaizer03
Nuclear Reactor
****

Pogi/Ganda Points: 219
Offline Offline

Posts: 4624


C#<-->Android<-->Java


WWW
« Reply #5 on: August 29, 2010, 11:58:24 AM »

if ever i could buy a GSM Module, i'd love to develop a software for C#.. i'll share it here..=)
Logged

Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
DataSheets are enough to answer your questions! Wink

Kaizer Killer EX Pre-Alpha
Dennis
Size C Battery
*****

Pogi/Ganda Points: 28
Offline Offline

Posts: 155



« Reply #6 on: August 29, 2010, 01:18:11 PM »

sa convert to .net kailangan niyo nito ng MSCOMM32.OCX  para sa MSComm1, similar siya sa serialport ng .net  pero marami kasi magkaiba function, pero puwedi rin palitan ng serialport components ito source http://www.yes-tele.com/mscomm.html MSCOMM32.OCX, sa reference i-add lang. sample ng convert MSComm1.Output equal siya SerialPort1.Write
Logged

Failure is not defeated, Unless you stop trying

OmegaByteŽ, ExplicitmindŽ, DMSoftwareŽ
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #7 on: August 29, 2010, 02:18:20 PM »





Uploaded with ImageShack.us


Sample App  :
http://rapidshare.com/files/415774598/SendRecivTatto_Vb6.zip
pass: www.electronicslab.ph
Logged
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #8 on: September 03, 2010, 12:42:34 PM »

Medyo madugo ang Power Line Communication kasi yung installed equipment nga dito sa planta hanggang ngayun di pa rin magawagawa. Equipment alone cost so much. Filters involved are so big since it is installed in the switch yard.

       Yah you are right sir. So far i have successfully transmitted a 300 Khz signal on a household line. The house in my own estimate is about 15mx25m and has two floors. I received the signal wherever I put the Tx/Rx circuit without a problem. But when i tried it on our campus building, the signal could not reach to a considerable distance. I suspect that this is due to the appliances on the campus especially the 40 PC's that is turned ON at the time i tried my circuit.
       It could have been better if the PC is not using the china made AVR (as if its an AVR). But to change all the AVR will be costly. So i guess my project would be more effective when applied to a regular house, no matter how large as long as there is not so many appliances present that filters my signal such as computers.
Embarrassed
Logged
7_SeVeN_7
Technical People
Solar Power Satellite
*****

Pogi/Ganda Points: 385
Offline Offline

Posts: 5974


There is no delight in owning anything unshared.


« Reply #9 on: September 03, 2010, 12:51:27 PM »

       I have finally created a vb6 mini prog to read a received mssg using Globe Tattoo's USB modem.  Grin Grin Thanks to master 7 and to master emond. Malayo pa ito sa tapos. It just fulfilled a very basic purpose, that is, it just displays the received mssg and can send a single text. But sa tingin ko it could be easily edited to suit other purposes (i hope).

   I know matawa kaau sa codes ko, noob pa talaga ako sa programming, sa school hindi talaga kami tinuruan. Mga master please let me know naman if mayroon mga dapat talagang baguhin sa codes ko. I obviously still needs to learn to use loops to optimize the way i code and also more importantly about buffers. And i have also the problem of storing the mscomm.input on a string that is why i still use the TextBox1 (which is obviously not necessary). I know that the way i use the timer is not so appropriate, but its the only way i know to constantly check something. I tried to search on google about AT+CNMA and AT+CNMI but I didnt find something useful.

   Bottom line, im still a beginner. But nevertheless i still hopes someone out there who is also a beginner may find this codes somewhat useful. I have included a command to check my balance because it is the only way I could send a text and receive a mssg even without a load.


Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim str1, str2, str3 As String
Dim lngPos1, lngPos2 As Integer
Dim strInput As String
Dim msgcheck As Variant
Option Explicit

Private Sub getmssg()
lngPos1 = InStrRev(Text1.Text, "32")    ' Usually there is a "32" near the start of the actual mssg and the mssg
lngPos1 = lngPos1 + 5                        ' usually ends with "OK"( response of the modem). Therefore the mssg must
lngPos2 = InStrRev(Text1.Text, "OK")   ' not contain a "32" or "OK". You could replace "32" with "X" or a symbol
lngPos2 = lngPos2 - 4                         ' like # if the mssg is expected to have an "X" or a symbol #. Other
lngPos2 = lngPos2 - lngPos1                ' symbols may also be used.
Text3.Text = Mid$(Text1.Text, lngPos1, lngPos2)
End Sub

Private Sub erazemssg()
Sleep 300
str1 = "AT+CMGD = 0"
MSComm1.Output = str1 & vbCr
End Sub

Private Sub viewmssg()
str1 = "AT+CMGR= 0"                         ' view the latest mssg recivd
MSComm1.Output = str1 & vbCr
End Sub

Private Sub Command1_Click()
erazemssg
Text3.Text = vbNullString
End Sub

Private Sub Command2_Click()
erazemssg
Unload Me
End Sub

Private Sub Command3_Click()
' Send an 'AT' command to the phone
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGS=" & Chr(34) & 222 & Chr(34) & vbCrLf
Sleep 800
MSComm1.Output = "BAL" & Chr(26)
Sleep 2000
Sleep 1500
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
End Sub

Private Sub Command4_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
MSComm1.Output = "AT+CMGS=" & Chr(34) & Text4.Text & Chr(34) & vbCrLf
Sleep 1000
MSComm1.Output = Text2.Text & Chr(26)
Sleep 4000
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End Sub

Private Sub Form_Load()
With MSComm1
'make sure the serial port is not open (by this program)
If .PortOpen Then .PortOpen = False
'set the active serial port
.CommPort = 5
'set the badurate,parity,databits,stopbits for the connection
.Settings = "9600,N,8,1"
'set the DRT and RTS flags
.DTREnable = True
.RTSEnable = True
'enable the oncomm event for every reveived character
.RThreshold = 1
'disable the oncomm event for send characters
.SThreshold = 0
'open the serial port
.PortOpen = True
End With
End Sub

Private Sub MSComm1_OnComm()
Text1.Text = ""
With MSComm1
'test for incoming event
Select Case .CommEvent
Case comEvReceive
'display incoming event data to displaying textbox
strInput = .Input
Text1.SelText = strInput
End Select
End With
End Sub

Private Sub Timer1_Timer()           'check for mssg every .4sec
viewmssg
str3 = Mid$(Text1.Text, 3, 6)
If str3 = "+CMGR:" Then
Beep
getmssg                              'displays the recivd mssg
erazemssg
End If
End Sub


'-----------end of Code---------------------


It can be downloaded here:
http://rapidshare.com/files/415468861/SendReciv_Vb6.zip Cheesy


pogi point for you... thanks for sharing Smiley Grin
Logged

E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  Grin
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #10 on: September 03, 2010, 01:32:22 PM »

... thanks for sharing Smiley Grin

Maraming salamat master 7. Actually ako ang dapat mag thank you sa inyo sir. Kung hindi dahil sa inyo seguro nag hahanap pa rin ako sa google hanggang ngayon kung paano maka receive ng mssg. Salamat ulit sir.   Grin
Logged
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #11 on: September 03, 2010, 03:59:30 PM »

sa convert to .net kailangan niyo nito ng MSCOMM32.OCX  para sa MSComm1, similar siya sa serialport ng .net  pero marami kasi magkaiba function, pero puwedi rin palitan ng serialport components ito source http://www.yes-tele.com/mscomm.html MSCOMM32.OCX, sa reference i-add lang. sample ng convert MSComm1.Output equal siya SerialPort1.Write

Salamat po sa info sir. i'll keep that in mind when i can get hold of a .net installer. Grin
Logged
maldihtah13
Technical People
Nuclear Reactor
*****

Pogi/Ganda Points: 114
Offline Offline

Gender: Female
Posts: 4499


Everyday is a learning process so try to learn ;D


WWW
« Reply #12 on: September 03, 2010, 08:46:34 PM »

I've done the VB 2010 version. It is still not yet that good since I don't have the time to make it presentable. If I have the time tomorrow I'll try to upload it.
Logged
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #13 on: September 04, 2010, 05:15:34 AM »

I've done the VB 2010 version. It is still not yet that good since I don't have the time to make it presentable. If I have the time tomorrow I'll try to upload it.

Wow very nice sir thank you.. kailan pa kaya ako maka pag download ng vb2010. Sad
Logged
Dennis
Size C Battery
*****

Pogi/Ganda Points: 28
Offline Offline

Posts: 155



« Reply #14 on: September 04, 2010, 10:30:49 AM »

watch this http://www.codeproject.com/KB/cs/SMS.aspx   C#
and this : http://www.codeproject.com/KB/IP/Send_and_Read_SMS.aspx
this one is very interesting for MMS: http://www.codeproject.com/KB/smart/MobileCommunication.aspx also C# Send Picture Message from PC to Mobile convert the image into OTA format then encode it.

Logged

Failure is not defeated, Unless you stop trying

OmegaByteŽ, ExplicitmindŽ, DMSoftwareŽ
_Lurker_
Diesel Generator
*

Pogi/Ganda Points: 109
Offline Offline

Gender: Male
Posts: 1282

....


« Reply #15 on: September 06, 2010, 12:40:02 PM »

watch this http://www.codeproject.com/KB/cs/SMS.aspx   C#
and this : http://www.codeproject.com/KB/IP/Send_and_Read_SMS.aspx
this one is very interesting for MMS: http://www.codeproject.com/KB/smart/MobileCommunication.aspx also C# Send Picture Message from PC to Mobile convert the image into OTA format then encode it.


Sayang walang VB6 version. Anyway thanks sir..
Logged
cliffromz23
Size AAA Battery
***

Pogi/Ganda Points: 1
Offline Offline

Gender: Male
Posts: 97



« Reply #16 on: September 06, 2010, 07:39:13 PM »

TNX MGA MASTER.... open kau  sa mga program...
nakakatulong to about my project....
http://www.electronicslab.ph/forum/index.php/topic,18813.0.html
Logged
emond
CR2032 Battery
**

Pogi/Ganda Points: 2
Offline Offline

Gender: Male
Posts: 25


Long Live TAU GAMMA


WWW
« Reply #17 on: September 08, 2010, 10:36:16 AM »

hehehe,,tnx sa papuri..lol..

try my new vb.net and windows mobile 5 and 6 version

http://www.sourcecodester.com/visual-basic-net/net-version-sending-sms-using-commands-gsm-modemgsm-phone.html

http://www.sourcecodester.com/visual-basic-net/send-sms-windows-mobile-5-6xx-or-7.html

emond
Logged

emond sabiniano
programmer/analyst-consultant
maldihtah13
Technical People
Nuclear Reactor
*****

Pogi/Ganda Points: 114
Offline Offline

Gender: Female
Posts: 4499


Everyday is a learning process so try to learn ;D


WWW
« Reply #18 on: September 12, 2010, 05:24:58 PM »

eto na yung VB 2010 version

http://www.4shared.com/file/-wFqOGNe/SendReciv_VB10.html
Logged
agentzero_it
CR2032 Battery
**

Pogi/Ganda Points: 0
Offline Offline

Posts: 11


« Reply #19 on: September 20, 2010, 08:28:37 AM »



anu po ung password para dito?
Logged
The Philippine Electronics and Technology Forum
   

 Logged
Pages: [1] 2 3 ... 27   Go Up
  Print  
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Globe Tattoo's USB HSDPA Modem:Interfacing to Hyperterminal and PL « 1 2 ... 8 9 »
Computer Interfacing and Digital Communications
7_SeVeN_7 174 19932 Last post September 04, 2011, 11:58:38 PM
by guy_gwapo
Globe Tattoo!
General Computers and Internet Talk
existing_evil 0 925 Last post June 10, 2009, 08:46:58 PM
by existing_evil
Detection of Globe Tattoo
General Computers and Internet Talk
MX45 4 1837 Last post November 04, 2009, 12:58:34 PM
by Woots29
bestbroadband globe tattoo/sun/smart
General Computers and Internet Talk
e172ece 11 1046 Last post May 25, 2010, 03:51:55 PM
by rdpzycho
SERIAL TO USB COMMUNICATION??? globe tattoo!
General Electronics and Technology Discussion
joboyx 9 512 Last post March 08, 2011, 09:58:07 PM
by rdpzycho
Globe tattoo in windows7
Cellular Phones and Accessories
badalicious 1 409 Last post September 10, 2010, 01:11:34 AM
by yujihro
Globe Tattoo Configuration
COE Students
martin11ph 0 244 Last post January 17, 2011, 01:10:31 AM
by martin11ph
Powered by MySQL Powered by PHP Powered by SMF 1.1.15 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!