summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike <mjc@avtechpulse.com>2000-01-01 00:37:54 +0900
committerMike <mjc@avtechpulse.com>2000-01-01 00:37:54 +0900
commit5fb7eccd0d238a976758dd1e33ef18931b83b91f (patch)
tree092bc4723819b170060b292d9295c574e16dd7ad
parentdd925747f7ac9fad9bb95920dc7b07db48c9c56d (diff)
implement full control of DACs 8-15
-rw-r--r--device-functions.c15
-rw-r--r--i2c.h4
-rw-r--r--instr-daemon.c5
3 files changed, 21 insertions, 3 deletions
diff --git a/device-functions.c b/device-functions.c
index eeddd67..d32c933 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4647,6 +4647,8 @@ void Main_update_shift_registers()
bus_setpin(out_STROBE_LINE, 0); // release latch
for (i=0; i<std_dacs; ++i) {
+ // OP1B on-board DACs
+
/* load the upper-nibble latch */
bus_writebyte ((uint8_t) (Octal_DACportCS_high), (uint8_t) (globals.Registers.parallel_DAC_reg[i] >> 8));
@@ -4654,6 +4656,19 @@ void Main_update_shift_registers()
bus_writebyte ((uint8_t) (Octal_DACportCS_low + i), (uint8_t) (globals.Registers.parallel_DAC_reg[i] & 255));
}
+ for (i=std_dacs; i<max_dacs; ++i){
+ // expansion DACs on PCB 313A
+ int addr;
+ addr = i-std_dacs; // shift down by 8
+
+ I2C_Write(PCF8574+Extra_DACs_Addr_Port, addr + 8); // load address, AD7839 WR high
+ I2C_Write(PCF8574+Extra_DACs_Data_Port, globals.Registers.parallel_DAC_reg[i] >> 8); // load upper byte data
+ I2C_Write(PCF8574+Extra_DACs_Addr_Port, addr + 16 + 8); // latch into HC574
+ I2C_Write(PCF8574+Extra_DACs_Data_Port, globals.Registers.parallel_DAC_reg[i] & 255); // load lower byte data
+ I2C_Write(PCF8574+Extra_DACs_Addr_Port, addr); // latch into AD7839
+ I2C_Write(PCF8574+Extra_DACs_Addr_Port, addr + 8); // latch into AD7839
+ }
+
/* keep trigger suppressed for a time (normally 5ms) after a relay update */
if ( globals.Registers.last_relay_driver_settings[0]!=globals.Registers.shift_reg_out[2]
|| globals.Registers.last_relay_driver_settings[1]!=globals.Registers.shift_reg_out[3]
diff --git a/i2c.h b/i2c.h
index 86a141c..b1b9f7e 100644
--- a/i2c.h
+++ b/i2c.h
@@ -6,8 +6,8 @@
#define To_Self_Cal_Port 2 /* PCF8574 at three-bit address 2 is for self-cal PCB 226A */
#define From_Self_Cal_Port 3 /* PCF8574 at three-bit address 3 is for self-cal PCB 226A */
#define Octal_Relay_Driver 4 /* PCF8574 at three-bit address 4 is for octal relay driver, PCB 244A */
-#define Extra_DACs_Low_Port 5 /* PCF8574 at three-bit address 5 is for low byte of PCB 313A DAC board */
-#define Extra_DACs_High_Port 6 /* PCF8574 at three-bit address 6 is for high byte of PCB 313A DAC board */
+#define Extra_DACs_Data_Port 5 /* PCF8574 at three-bit address 5 is for the data byte of PCB 313A DAC board */
+#define Extra_DACs_Addr_Port 6 /* PCF8574 at three-bit address 6 is for address lines of PCB 313A DAC board */
#define PCF8574A 0x38 /* Main I2C peripheral device */
#define Button_Press_Port 0 /* PCF8574A at three-bit address 0 is for detecting button presses */
diff --git a/instr-daemon.c b/instr-daemon.c
index fa16202..45ba979 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -243,9 +243,12 @@ int main(int argc, char **argv)
g_free (message);
int i;
- for (i=0; i<8; i++) {
+ for (i=0; i<std_dacs; i++) {
set_dac(i,globals.Flash.initial_dac_settings[i]);
}
+ for (i=std_dacs; i<max_dacs; i++) {
+ set_dac(i,dac_max/8);
+ }
fixFlash(&globals.Flash);