|
-
Feb 12th, 2009, 06:11 PM
#1
Thread Starter
Lively Member
need to send a binary number out my serial
will this send out the binary equivilent of "212" ascii?
mscomm1.output = chr$(212)
if not how do I?
i came across this:
Dim bit(8), DecVal As Integer
Decval= text1.text
If DecVal >= 128 Then bit(7) = 1: DecVal = DecVal - 128 Else bit(7) = 0
If DecVal >= 64 Then bit(6) = 1: DecVal = DecVal - 64 Else bit(6) = 0
If DecVal >= 32 Then bit(5) = 1: DecVal = DecVal - 32 Else bit(5) = 0
If DecVal >= 16 Then bit(4) = 1: DecVal = DecVal - 16 Else bit(4) = 0
If DecVal >= 8 Then bit(3) = 1: DecVal = DecVal - 8 Else bit(3) = 0
If DecVal >= 4 Then bit(2) = 1: DecVal = DecVal - 4 Else bit(2) = 0
If DecVal >= 2 Then bit(1) = 1: DecVal = DecVal - 2 Else bit(1) = 0
If DecVal >= 1 Then bit(0) = 1: DecVal = DecVal - 1 Else bit(0) = 0
but then do i just do:
mscomm1.output = Decval
?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|