public void StandBy() { UpdateHardware = false; DDSTuningWord = 0; ResetDDS(); byte pio_ic1_temp = pio_ic1.GetData(); pio_ic1.SetData(0); pio_ic1.SetBit(MUTE); byte pio_ic3_temp = pio_ic3.GetData(); pio_ic3.SetData(0); byte rfe_ic7_temp = 0; byte rfe_ic9_temp = 0; byte rfe_ic10_temp = 0; byte rfe_ic11_temp = 0; if (rfe_present) { rfe_ic7_temp = rfe_ic7.GetData(); rfe_ic7.SetData(0); rfe_ic7.SetBit(PA_BIAS); rfe_ic9_temp = rfe_ic9.GetData(); rfe_ic9.SetData(0); rfe_ic10_temp = rfe_ic10.GetData(); rfe_ic10.SetData(0); rfe_ic11_temp = rfe_ic11.GetData(); rfe_ic11.SetData(0); rfe_ic11.SetBit(ADC_CS_NOT); } UpdateHardware = true; UpdateHardware = false; pio_ic1.SetData(pio_ic1_temp); pio_ic3.SetData(pio_ic3_temp); if (rfe_present) { rfe_ic7.SetData(rfe_ic7_temp); rfe_ic9.SetData(rfe_ic9_temp); rfe_ic10.SetData(rfe_ic10_temp); rfe_ic11.SetData(rfe_ic11_temp); } }
private void UpdateRegister8(byte data, object user_data) { Config config = (Config)user_data; switch (config.config) { case PIO: if (usb_present) { byte address = 0; switch (config.address) { case PIO_IC1: address = USB.SDR1K_LATCH_BPF; break; case PIO_IC3: address = USB.SDR1K_LATCH_EXT; break; default: address = 0; break; } USB.Sdr1kLatch(address, data); } else { LatchRegister(lpt_addr, config.address, data); } break; case RFE: if (usb_present) { USB.Sdr1kSRLoad(config.address, data); } else { byte tmp_data; byte pio_data = (byte)(pio_ic1.GetData() & 0xC0); // Shift 8 bits into the 4 RFE shift registers for (int i = 0x80; i > 0; i >>= 1) { if ((i & data) == 0) // Current bit is low { tmp_data = (byte)(pio_data | SCLR_NOT); tmp_data |= DCDR_NE; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Output 0 bit tmp_data |= SCK; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Clock 0 into shift register } else // Current bit is high { tmp_data = (byte)(pio_data | SCLR_NOT); tmp_data |= DCDR_NE; tmp_data |= SER; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Output 1 bit tmp_data |= SCK; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Clock 1 into shift register } tmp_data = (byte)(pio_data | SCLR_NOT); tmp_data |= DCDR_NE; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Return SCK low } // Strobe the RFE 1:4 decoder output to transfer contents // of shift register to output latches tmp_data = (byte)(pio_data | SCLR_NOT); tmp_data |= config.address; tmp_data |= DCDR_NE; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Latch 2:4 decoder outputs tmp_data = (byte)(pio_data | SCLR_NOT); tmp_data |= config.address; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Take 2:4 decoder enable low tmp_data = (byte)(pio_data | SCLR_NOT); tmp_data |= config.address; tmp_data |= DCDR_NE; LatchRegister(lpt_addr, PIO_IC1, tmp_data); // Take 2:4 decoder enable high } break; } }