|
Next: Interrupt Vector Table, boardvect.c
Up: Control Board
Previous: Firmware Build, Makefile
  Contents
The following code implements a simple operation mode of the control
board in which fader data is sent out as MIDI controller changes.
/*****************************************************************************
* DACS : Distributed Audio Control System
*============================================================================
* File: boardmain.c
* Author: Stephen S. Richardson
* Date Created: 04.14.97
* Environment: ICC11 v3.6, 68HC11 target
* Build: library, not standalone
*============================================================================
* The code, executables, documentation, firmware images, and all related
* material of DACS are
* Copyright (C) 1997 Stephen S. Richardson - ALL RIGHTS RESERVED
*****************************************************************************/
#include <hc11.h>
#include "build.h"
#include "stdlcd.h"
#include "gfxlcd.h"
#include "lcddefn.h"
#include "SCIserial.h"
#include "pbus.h"
#include "pbusdefn.h"
unsigned char get_ad (unsigned char ch)
{
ADCTL = ch;
while (!(ADCTL & 0x80));
return(ADR1);
}
void get_faders (unsigned char *list)
{
unsigned char hc, m;
int i;
PBC_PX=PBC_OX; /* pBUS in output mode */
PBC_PC^=PB_N_LATCH+PB_N_CLOCK; /* pBUS latch- and clock- inactive */
PBC_PA=0; /* data on pBUS */
PBC_PB=PBADX_FADEMUX0^PB_N_RD_WR; /* addx on pBUS, write mode */
PBC_PC&=~PB_N_LATCH; /* pBUS latch- active */
for (m=0;m<8;m++) {
for (i=0;i<100;i++);
PBC_PA=m; /* data on pBUS */
ADCTL = 0;
while (!(ADCTL & 0x80));
list[m]=(ADR1+ADR2+ADR3+ADR4)/4;
}
PBC_PC^=PB_N_LATCH; /* pBUS latch- inactive */
PBC_PA=0; /* data on pBUS */
PBC_PB=PBADX_FADEMUX1^PB_N_RD_WR; /* addx on pBUS, write mode */
PBC_PC&=~PB_N_LATCH; /* pBUS latch- active */
for (m=0;m<8;m++) {
for (i=0;i<100;i++);
PBC_PA=m; /* data on pBUS */
ADCTL = 1;
while (!(ADCTL & 0x80));
list[m+8]=(ADR1+ADR2+ADR3+ADR4)/4;
}
PBC_PC^=PB_N_LATCH; /* pBUS latch- inactive */
}
void main (void) {
int optrex_init[]=OPTREX16x1_INIT;
unsigned char i,n,j;
unsigned char faders[16], oldfaders[16];
OPTION^=0x80;
stdlcd_init(OPTREX16x1, optrex_init);
stdlcd_goto(OPTREX16x1, 0);
stdlcd_out(OPTREX16x1, "TRANSPOR");
stdlcd_goto(OPTREX16x1, 0x40);
stdlcd_out(OPTREX16x1, "T CONTRL");
SCI_init();
pbus_init();
gfxlcd_init();
for (i=0;i<16;i++) {
faders[i]=0;
oldfaders[i]=2;
}
while (1) {
get_faders (faders);
for (n=0;n<16;n++) {
i=faders[n] / 5;
j=faders[n] / 2;
if ((oldfaders[n]/5)!=(faders[n]/5)) {
gfxlcd_btmbar (n, i);
SCI_chout (0xB0);
SCI_chout (n);
SCI_chout (j);
}
oldfaders[n] = faders[n];
}
}
}
Steve Richardson
2000-07-06
|
Table of Contents
[Whole document in PDF 1.9MB]
[more photos and information]
|