Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old October 21st, 2003, 09:01 AM
vb123 vb123 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Germany
Posts: 16 vb123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to vb123
My Question Again

Private Sub Command1_Click()
On Error GoTo trap
Dim timeout As Variant
Dim sende As String
Dim checksum As String
Dim i
MSCmm1.PortOpen = True
Command1.Enabled = False
sende = ""
empfang = ""
'sende = Chr$(&H10) + Chr$(&H5B) + Chr$(&HFE) + Chr$(&H59) + Chr$(&H16) 'Direct communication for the CF-ECHO
sende = Chr$(&H10) + Chr$(&H5B) + Chr$(&H1) + Chr$(&H5C) + Chr$(&H16) 'First external Communication attached to CF-ECHO

MSCmm1.Output = sende
timeout = Now() + 2 / 86400
Do
DoEvents
Loop Until Now() > timeout
Print Len(empfang)

Text1.Text = ""
For i = 1 To Len(empfang)
Text1.Text = Text1.Text + " " + HexByte(Asc(Mid(empfang, i, 1)))
Next


Print "Tv=", Val(HexByte(Asc(Mid(empfang, 51, 1))) + HexByte(Asc(Mid(empfang, 50, 1)))) / 10
Print "Return Temparature =", Val(HexByte(Asc(Mid(empfang, 55, 1))) + HexByte(Asc(Mid(empfang, 54, 1))))
/ 10

Command1.Enabled = True
MSCmm1.PortOpen = False

trap:

End Sub
Private Sub MSCmm1_OnComm()
empfang = empfang + MSCmm1.Input
End Sub
Private Function HexByte(b As Byte) As String

Const HexChar = "0123456789ABCDEF"
Dim upbit As Byte 'Upper Nibble
Dim lowbit As Byte 'Lower Nibble
upbit = b \ 16
lowbit = b Mod 16
HexByte = Mid(HexChar, upbit + 1, 1) + Mid(HexChar, lowbit + 1, 1)

End Function

The above code is working form for calculation of temparature from a
device attached to com1 port and another two objects are
connected,which delivers the required temparature.

Now my problem is i must do the following
Empfang function writing
sende code for 1 to the empfang
data receiving for sende code1 from the empfang function
sende code for 2 to the empfang
data receiving for sende code2 from the emfang function
sende code for either 1 or 2 to use the empfang function to receive 1 & 2 sende together
For which i do wrote the code like the following but i could not able
to receive the output as i required

Option Explicit
Dim sende As String
Dim i

Private Function empfang(str As String)
Dim timeout As Variant

' empfang = ""

str = ""
For i = 1 To Len(str)
str = str + " " + HexByte(Asc(Mid(empfang, i, 1)))
Next
timeout = Now() + 2 / 86400
Do
DoEvents
Loop Until Now() > timeout
Print Len(str)


'timeout = Now() + 2 / 86400
' Do
' DoEvents
' Loop Until Now() > timeout
' Print Len(str)
empfang = str
End Function
Private Function HexByte(b As Byte) As String
'This function a byte converts into Hex representation
Const HexChar = "0123456789ABCDEF"
Dim upbit As Byte 'Upper Nibble
Dim lowbit As Byte 'Lower Nibble
upbit = b \ 16
lowbit = b Mod 16
HexByte = Mid(HexChar, upbit + 1, 1) + Mid(HexChar, lowbit + 1, 1)
'Hex for representation for byte produce
End Function

Private Sub Command1_Click()

Dim checksum As String

Dim s As String
MSCmm1.PortOpen = True
Command1.Enabled = False
sende = ""
s = ""
'sende = Chr$(&H10) + Chr$(&H5B) + Chr$(&HFE) + Chr$(&H59) +
Chr$(&H16) 'Direct communication for the CF-ECHO
sende = Chr$(&H10) + Chr$(&H5B) + Chr$(&H1) + Chr$(&H5C) +
Chr$(&H16) 'First external Communication attached to CF-ECHO
Call empfang(sende)

'MSCmm1.Output = sende
''s = Val(HexByte(Asc(Mid(s, 51, 1))) + HexByte(Asc(Mid(s, 50,
1)))) / 10
's = 33
'Print HexByte(Asc(Mid(s, 51, 1)))
''Print "Tv=", Val(HexByte(Asc(Mid(s, 51, 1))) + HexByte(Asc(Mid(s,
50, 1)))) / 10
'Print "Return Temparature =", Val(HexByte(Asc(Mid(s, 55, 1))) +
HexByte(Asc(Mid(s, 54, 1)))) / 10

Command1.Enabled = True
MSCmm1.PortOpen = False

'trap:

End Sub

Private Sub Form_Load()
MSCmm1.Settings = "9600, e, 8, 1"
MSCmm1.CommPort = 1
End Sub

Reply With Quote
  #2  
Old May 9th, 2004, 03:50 PM
phiber phiber is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: denmark
Posts: 4 phiber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to phiber Send a message via MSN to phiber
Hey

Can you tell me how i make a program in vb so i can call my pc from a phone and for example press 1 and then my pc restart?

Or do you know how i can call a phone and then play an audio file, i can make a program that call a phone, but what can i use i to, when im not can play an audio file.... hehe

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > My Question Again


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway