ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#21269 - 08/10/09 02:25 PM VB code send IR 255 plus
MarkA1 Offline
newbie


Registered: 08/10/09
Posts: 2
I have been using a VB program to control my IR devices, and it has worked fine. I've added a few devices, and now I realize my program can not handle sending anything higher than 255.

Can I modify this to send higher codes, or program code examples of how to do it another way.

Here is my present code:

Dim tempstring(8) As Byte
Dim tempstring2(8) As Byte
Dim tempstring3(8) As Byte
Dim tempstring4(8) As Byte
Dim number As Integer

number = Val(irin)

tempstring(0) = 200
tempstring(1) = 90
tempstring(2) = number
tempstring(3) = 0
tempstring(4) = 0
tempstring(5) = 0
tempstring(6) = 0

tempstring(7) = CheckSum(tempstring, 7)

Form1.MSComm1.Output = tempstring

Private Function CheckSum(ByRef Buffer() As Byte, Size As Byte) As Byte
Dim i, CSum
CSum = 0
For i = 0 To Size
CSum = CSum + Buffer(i)
Next
CheckSum = CSum Mod 256

End Function

Thanks for any help you can give!

Mark

Top
#21270 - 08/10/09 04:01 PM Re: VB code send IR 255 plus [Re: MarkA1]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
The serial protocol allows for two bytes to specify the IR code number. The byte you are currently using is the low byte, and the next one the high byte. So it actually goes like this:

tempstring(0) = 200
tempstring(1) = 90
tempstring(2) = low byte
tempstring(3) = high byte
tempstring(4) = 0
tempstring(5) = 0
tempstring(6) = 0

tempstring(7) = CheckSum(tempstring, 7)


For example, to send code # 300 you would set tempstring(2) = 44 and tempstring(3) = 1
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#21271 - 08/10/09 04:16 PM Re: VB code send IR 255 plus [Re: Guy Lavoie]
MarkA1 Offline
newbie


Registered: 08/10/09
Posts: 2
Guy,

Thank you so much!

Then for the high byte, would it go to 2 for 512, etc.?

I can not tell you how thankful I am to you for your answer! I have been knocking around for hours, for this answer.

Top
#21272 - 08/10/09 06:06 PM Re: VB code send IR 255 plus [Re: MarkA1]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
Yes, 2 for 512 ... 3 for 768 You have the right idea.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 26 anonymous users online.
Recent Posts
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Does anyone have a copy of the latest TSE?
by sevenzenith1
01/30/12 05:17 AM
Have HAL2000 do the work or the Ocelot?
by khem
01/28/12 02:49 PM
Ocelot + Powermid = Fail
by Guy Lavoie
01/27/12 03:37 PM
Shout Box

Newest Members
dfgg, manu, kuro, sevenzenith1, chuck214
2748 Registered Users
Forum Stats
2747 Members
19 Forums
3835 Topics
22711 Posts

Max Online: 67 @ 08/16/11 03:08 PM
February
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29