Re: Convert long number to ascii
- From: "Jim Mack" <jmack@xxxxxxxxxxxxxxx>
- Date: Sun, 4 Feb 2007 08:19:15 -0500
jonny wrote:
How can i convert a long number to ascii and transmit it through a com
port using mscomm? When I try to send through the com port I receive
and error code 380 Invalid property value. I've checked my
cofiguration of mscomm and it all seems correct but it just doesn't
work. Any help would be greatly appreciated.
Adding the information from your other post, it looks as if what your display wants is two Ascii characters for the device address, then four (or five, if using a DP) for the value.
Assuming you know the address of the device (say, "01") , and you want to display "23.4" on it, try this or variations of it:
Dim AddrNum As Long
Dim Addr As String
Dim ValuNum As Single
Dim Valu As String
AddrNum = 1
ValuNum = 23.4
Addr = Right$("0" & CStr(AddrNum), 2) ' "00" - "99" to two places
Valu = Format$(ValuNum, "000.0") ' "023.4" with leading 0s
MSComm1.Output Addr & Valu
--
Jim Mack
MicroDexterity Inc
www.microdexterity.com
.
- Follow-Ups:
- Re: Convert long number to ascii
- From: jonny
- Re: Convert long number to ascii
- References:
- Convert long number to ascii
- From: jonny
- Convert long number to ascii
- Prev by Date: Re: Can't make my form bigger in Design mode?
- Next by Date: Migrating from VBA to VB6
- Previous by thread: Re: Convert long number to ascii
- Next by thread: Re: Convert long number to ascii
- Index(es):
Relevant Pages
|