_Lurker_
Diesel Generator
Pogi/Ganda Points: 109
Offline
Gender: 
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.  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. 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 
|
|
|
|
|
Logged
|
|
|
|
|
The Philippine Electronics and Technology Forum
|
 |
« on: August 27, 2010, 11:18:18 PM » |
|
|
|
|
|
|
Logged
|
|
|
|
_Lurker_
Diesel Generator
Pogi/Ganda Points: 109
Offline
Gender: 
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.  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
Gender: 
Posts: 4499
Everyday is a learning process so try to learn ;D
|
 |
« 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
Gender: 
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.. 
|
|
|
|
|
Logged
|
|
|
|
maldihtah13
Technical People
Nuclear Reactor
   
Pogi/Ganda Points: 114
Offline
Gender: 
Posts: 4499
Everyday is a learning process so try to learn ;D
|
 |
« 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
Posts: 4624
C#<-->Android<-->Java
|
 |
« 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! Kaizer Killer EX Pre-Alpha
|
|
|
|
Dennis
|
 |
« 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
Gender: 
Posts: 1282
....
|
 |
« Reply #7 on: August 29, 2010, 02:18:20 PM » |
|
|
|
|
|
|
Logged
|
|
|
|
_Lurker_
Diesel Generator
Pogi/Ganda Points: 109
Offline
Gender: 
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. 
|
|
|
|
|
Logged
|
|
|
|
7_SeVeN_7
Technical People
Solar Power Satellite
   
Pogi/Ganda Points: 385
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.  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. 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  pogi point for you... thanks for sharing 
|
|
|
|
|
Logged
|
E-Gizmo Mechatronix Central: www.e-gizmo.comTel #: (63)(2) 536-3378 Globe +63915-973-7691 Smart +63921-779-0748 Location MapYM: julie.egizmo aka Born2BeWired 
|
|
|
_Lurker_
Diesel Generator
Pogi/Ganda Points: 109
Offline
Gender: 
Posts: 1282
....
|
 |
« Reply #10 on: September 03, 2010, 01:32:22 PM » |
|
... thanks for sharing  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. 
|
|
|
|
|
Logged
|
|
|
|
_Lurker_
Diesel Generator
Pogi/Ganda Points: 109
Offline
Gender: 
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. 
|
|
|
|
|
Logged
|
|
|
|
maldihtah13
Technical People
Nuclear Reactor
   
Pogi/Ganda Points: 114
Offline
Gender: 
Posts: 4499
Everyday is a learning process so try to learn ;D
|
 |
« 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
Gender: 
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. 
|
|
|
|
|
Logged
|
|
|
|
|
|
_Lurker_
Diesel Generator
Pogi/Ganda Points: 109
Offline
Gender: 
Posts: 1282
....
|
 |
« Reply #15 on: September 06, 2010, 12:40:02 PM » |
|
Sayang walang VB6 version. Anyway thanks sir..
|
|
|
|
|
Logged
|
|
|
|
|
|
emond
CR2032 Battery

Pogi/Ganda Points: 2
Offline
Gender: 
Posts: 25
Long Live TAU GAMMA
|
 |
« Reply #17 on: September 08, 2010, 10:36:16 AM » |
|
|
|
|
|
|
Logged
|
emond sabiniano programmer/analyst-consultant
|
|
|
maldihtah13
Technical People
Nuclear Reactor
   
Pogi/Ganda Points: 114
Offline
Gender: 
Posts: 4499
Everyday is a learning process so try to learn ;D
|
 |
« Reply #18 on: September 12, 2010, 05:24:58 PM » |
|
|
|
|
|
|
Logged
|
|
|
|
agentzero_it
CR2032 Battery

Pogi/Ganda Points: 0
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
|
|
|
|
|