HTD MC-66 Multi-Zone Controller: Difference between revisions
Appearance
Created page with "Sold by Home Theater Direct (http://www.htdirect.com). Provides matrix switching 6 input: 6 ouput == Example Control Code provided by manufacturer == Example of C Code writte..." |
|||
| Line 7: | Line 7: | ||
Example of C Code written to turn the Volume Up in one Zone of the MCA66 Controller through the RS232 Serial Port | Example of C Code written to turn the Volume Up in one Zone of the MCA66 Controller through the RS232 Serial Port | ||
This particular example was written for use in a Lantronix Network-to-RS232 Controller, but it should still be helpful. | This particular example was written for use in a Lantronix Network-to-RS232 Controller, but it should still be helpful. | ||
Note: Although this was written to send commands to the MC66 & MCA66 Controllers, aside from specific differences in the calls, it should also be useful in understanding how to write a similar C program for the Lync systems. | Note: Although this was written to send commands to the MC66 & MCA66 Controllers, aside from specific differences in the calls, it should also be useful in understanding how to write a similar C program for the Lync systems. | ||
Revision as of 23:40, 15 April 2012
Sold by Home Theater Direct (http://www.htdirect.com).
Provides matrix switching 6 input: 6 ouput
Example Control Code provided by manufacturer
Example of C Code written to turn the Volume Up in one Zone of the MCA66 Controller through the RS232 Serial Port
This particular example was written for use in a Lantronix Network-to-RS232 Controller, but it should still be helpful.
Note: Although this was written to send commands to the MC66 & MCA66 Controllers, aside from specific differences in the calls, it should also be useful in understanding how to write a similar C program for the Lync systems.
void sendVolUpToHW(BYTE zoneNum)
{
sendCMD_0x04(zoneNum, 0x09);
}
void sendCMD_0x04(BYTE zoneNum, BYTE data)
{
BYTE cmd[6];
cmd[0] = 0x02;
cmd[1] = 0x00;
cmd[2] = zoneNum + 1; // hardware is one-based index
cmd[3] = 0x04;
cmd[4] = data;
cmd[5] = cmd[0]+cmd[1]+cmd[2]+cmd[3]+cmd[4];
serialSend(0, cmd, 6);
nice();
}
static int serialSend(int chan, BYTE *buf, int len) {
TCB save;
CCB *saveCCB;
BYTE *ptr;
int i;
/* Save the current associated stream */
memcpy(&save, ActPro, sizeof(TCB));
saveCCB = ActCCB;
/* Set to new channel and send data */
ActPro->CCB_Ptr = &AllCCB[chan];
ActPro->Chan_Nr = chan;
ActPro->IO_Ptr = AllCCB[chan].IOPtrs;
ActCCB = &AllCCB[chan];
FlushIn();
sendblk(buf, len);
/* Restore old stream */
memcpy(ActPro, &save, sizeof(TCB));
ActCCB = saveCCB;
return(len);
}