Programing for a Barco Projector
ryanww
Posts: 196
I am trying to figure out how to program code with a Barco r6 performer. For the time being, I was able to make it work with some of the commands it accepts which are just emulating the IR remote.
The thing I am trying to figure out is to send a certain command that it accepts that gives me 5 things of status of which I need. Here is the code from the manual.
Description :
Read the projector status.
Command :
Command[0] $67
Data :
No data bytes.
Return data :
The return data consists of one data byte containing the
projector status. Only bit0 (least significant bit) to
bit3/bit4* are significant.
bit# bit = 0 bit = 1
bit0 projector is off projector is on
bit1 text is off text is on
bit2 video mute is off video mute is on
bit3 picture is not frozen picture is frozen
bit4* no 800-peripheral 800-peripheral
Example :
Read the status of a projector with address $01.
Suppose the status is projector on, text on, video mute off, picture frozen and no 800-peripheral connected.
Transmit
Start $fe
Projector address $01
Command[0] $67
Checksum $68
Stop $ff
Receive (acknowledge)
Start $fe
Projector address $01
Command[0] $00
Command[1] $06
Checksum $07
Stop $ff
Receive (answer)
Start $fe
Projector address $01
Command[0] $67
Data[0] $0b
Checksum $73
Stop $ff
Really the only thing I am concerned with is the power status and the image freeze. I am planning on just running this command often just running a pseudo loop in the code.
Here is my problem. I really don?t understand the bitwise operators. I really don?t know how to go about extracting these values from the byte. I looked at the bitwise operator document but I wouldn?t know where to begin to even get it from the string it self. I am guessing I would have to get it from a mid string command. All I need it to do is set a 0 or a 1 to a variable for power and freeze then I can correspond that with the buttons I need to show status on. Heres the worst part.. I have 2 of these projectors using the same serial card. It is using the rs- 422 and the 2 projectors are individually addressed as #2 and #3. Another side note, I am using axcess. Would upgrading to netlinx make this a whole lot easier? I just have too much to sit there and constantly poll to get the status on. Nothing really auto sends the amx constantly. Also is there an easier way to get the status by sending the string, then analyzing it by using if commands? I cant think of another way to do so.
Thanks, Ryan
The thing I am trying to figure out is to send a certain command that it accepts that gives me 5 things of status of which I need. Here is the code from the manual.
Description :
Read the projector status.
Command :
Command[0] $67
Data :
No data bytes.
Return data :
The return data consists of one data byte containing the
projector status. Only bit0 (least significant bit) to
bit3/bit4* are significant.
bit# bit = 0 bit = 1
bit0 projector is off projector is on
bit1 text is off text is on
bit2 video mute is off video mute is on
bit3 picture is not frozen picture is frozen
bit4* no 800-peripheral 800-peripheral
Example :
Read the status of a projector with address $01.
Suppose the status is projector on, text on, video mute off, picture frozen and no 800-peripheral connected.
Transmit
Start $fe
Projector address $01
Command[0] $67
Checksum $68
Stop $ff
Receive (acknowledge)
Start $fe
Projector address $01
Command[0] $00
Command[1] $06
Checksum $07
Stop $ff
Receive (answer)
Start $fe
Projector address $01
Command[0] $67
Data[0] $0b
Checksum $73
Stop $ff
Really the only thing I am concerned with is the power status and the image freeze. I am planning on just running this command often just running a pseudo loop in the code.
Here is my problem. I really don?t understand the bitwise operators. I really don?t know how to go about extracting these values from the byte. I looked at the bitwise operator document but I wouldn?t know where to begin to even get it from the string it self. I am guessing I would have to get it from a mid string command. All I need it to do is set a 0 or a 1 to a variable for power and freeze then I can correspond that with the buttons I need to show status on. Heres the worst part.. I have 2 of these projectors using the same serial card. It is using the rs- 422 and the 2 projectors are individually addressed as #2 and #3. Another side note, I am using axcess. Would upgrading to netlinx make this a whole lot easier? I just have too much to sit there and constantly poll to get the status on. Nothing really auto sends the amx constantly. Also is there an easier way to get the status by sending the string, then analyzing it by using if commands? I cant think of another way to do so.
Thanks, Ryan
0
Comments
If you take your response string and take the $0b, put it into the windows calculator under HEX and then choose binary. You will see that you get 1011.
Which tells us, reading from the right to the left.
Bit 0 is 1 which means the projector is on
Bit 1 is 1 which means the text is on
Bit 2 is 0 which means video mute is off
Bit 3 is 1 which means freeze is on
now you want to test this with lets say a AND bitwise operator. You will use the equivalent of 1001 binary or $09 to test for just the power and freeze functions.
If two ones are ANDed together you get a 1 and if a 1 and 0 are ANDed together, you get a 0. So from there you just put that together and see what possible results you can get, or you can AND it against each spot individually, its really your choice. If I find some time tomorrow I will give you a sample piece of code that would work for you and I will write it in Axcess for you.
This paper is intended to accomplish these objectives:
Understand how numbers are represented and how they correlate to the various data types in the Axcess and NetLinx languages.
Learn the Bitwise operators and how they work.
See some practical applications of how the operators are used.
Thanks, Ryan
IF(LENGTH_STRING(vcPROJ_BUFF))
to activate everything, could I use:
IF(FIND_STRING(vcPROJ_BUFF,$FE,$02,$67,$??,$??,$FF",1)
that way I will know that it is getting the right string since it does kick a response right back after I send the request string then the actual status string and I know it is for the correct projector.
Also, what is vcRESPONSE="" down at the bottom for? Is it to just clear the variable?
Thanks! Ryan
The vcRESPONSE="" does clear the variable.
Thanks,
Ryan
Ryan, I would like to point out that this will work for sure every time based on the info you gave me:
Obviously it won't ever see the command to request it.
The acknowledge command start with fe,01,00
Whereas the data comes back with the start of fe,01,67
Then you can just copy the whole active statement and paste another one below it and change the find string to fe,02,67 and that would give you any info pertaining to a projector at address 02, etc.
edit: I noticed in the post above I had statements to the effect of ON[7,n] which I was using for testing and are not needed, so I removed them from the post.
vcRESPONSE=REMOVE_STRING(vcPROJ_BUFF,"$FF",1)
it was finding that first string and bringing it into the vcresponce which doesn't have any of the correct data to continue on, so nothing was happening. What I ended up doing was putting an additional remove string to trash the first string then have that line above. Works like a charm. Thanks again!
Well what it should have done is pulled that first line through on the first run through mainline and then it should have processed the next command leading up to the $FF when it ran through mainline again. But either way, Im glad you got it to work.