private void ResetDDS() { if (ozy_control) { OzySDR1kControl.DDSReset(); } else if (usb_present) { USB.Sdr1kDDSReset(); } else { LatchRegister(lpt_addr, PIO_IC8, DDSRESET | DDSWRB); // Reset the DDS chip LatchRegister(lpt_addr, PIO_IC8, DDSWRB); // Leave WRB high } DDSWrite(COMP_PD, 0x1D); //Power down comparator if (pll_mult == 1) { DDSWrite(BYPASS_PLL, 0x1E); } else { DDSWrite((byte)pll_mult, 0x1E); } DDSWrite(BYPASS_SINC, 0x20); }
private void DDSWrite(byte data, byte addr) #endif { if (ozy_control) { OzySDR1kControl.DDSWrite(addr, data); } else if (usb_present) { USB.Sdr1kDDSWrite(addr, data); } else { //Set up data bits LatchRegister(lpt_addr, PIO_IC11, data); //Set up address bits with WRB high LatchRegister(lpt_addr, PIO_IC8, (byte)(addr | DDSWRB)); //Send write command with WRB low LatchRegister(lpt_addr, PIO_IC8, addr); //Return WRB high LatchRegister(lpt_addr, PIO_IC8, (byte)(addr | DDSWRB)); } }
private void DDSWrite(byte data, byte addr) { if (ozy_control) { OzySDR1kControl.DDSWrite(addr, data); } else if (usb_present) { USB.Sdr1kDDSWrite(addr, data); } else if (isHPSDRorHermes()) { ; // do nothing } else { //Set up data bits //LatchRegister(lpt_addr, PIO_IC11, data); //Set up address bits with WRB high //LatchRegister(lpt_addr, PIO_IC8, (byte)(addr | DDSWRB)); //Send write command with WRB low //LatchRegister(lpt_addr, PIO_IC8, addr); //Return WRB high //LatchRegister(lpt_addr, PIO_IC8, (byte)(addr | DDSWRB)); } }
public byte StatusPort() { if (ozy_control) { return((byte)OzySDR1kControl.GetStatusPort()); } else if (usb_present) { return((byte)USB.Sdr1kGetStatusPort()); } else { if (ignore_ptt) { return(0); /* kd5tfd hack */ } else { if (lpt_addr != 0x0) { return(Parallel.inport((ushort)(lpt_addr + 1))); } else { return(0); } } } }
public byte StatusPort() { if (usb_present) { return((byte)USB.Sdr1kGetStatusPort()); } else { return(Parallel.inport((ushort)(lpt_addr + 1))); } }
public byte StatusPort() { if (usb_present) { return((byte)USB.Sdr1kGetStatusPort()); } else if (lpt_addr == 0) //[patch_4 { return(0); } else //patch_4] { return(Parallel.inport((ushort)(lpt_addr + 1))); } }
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; } }
public byte PA_GetADC(int chan) { // get ADC on amplifier // 0 for forward power, 1 for reverse if (usb_present) { int data = USB.Sdr1kGetADC(); if (chan == 0) { return((byte)(data & 255)); } else // chan == 1 { return((byte)(data >> 8)); } } PA_ADC_CS_NOT = false; // CS not goes low PA_ADC_DI = true; // set DI bit high for start bit PA_ADC_CLK = true; // clock it into shift register PA_ADC_CLK = false; // set DI bit high for single ended -- done since DI is already high PA_ADC_CLK = true; // clock it into shift register PA_ADC_CLK = false; if (chan == 0) // Forward Power { PA_ADC_DI = false; // set DI bit low for Channel 0 } else // Reverse Power { // set DI bit high for Channel 1 -- done since DI is already high } PA_ADC_CLK = true; // clock it into shift register PA_ADC_CLK = false; short num = 0; for (int i = 0; i < 8; i++) // read 15 bits out of DO { PA_ADC_CLK = true; // clock high PA_ADC_CLK = false; // clock low if ((StatusPort() & (byte)StatusPin.PA_DATA) != 0) // read DO { num++; // add bit } if (i != 7) { num <<= 1; } } PA_ADC_CS_NOT = true; // CS not goes high // if((num & 1<<14)>>14 != (num & 1<<0)>>0 || // (num & 1<<13)>>13 != (num & 1<<1)>>1 || // (num & 1<<12)>>12 != (num & 1<<2)>>2 || // (num & 1<<11)>>11 != (num & 1<<3)>>3 || // (num & 1<<10)>>10 != (num & 1<<4)>>4 || // (num & 1<<9)>>9 != (num & 1<<5)>>5 || // (num & 1<<8)>>8 != (num & 1<<6)>>6) // { // Debug.WriteLine("ADC Error"); // for(int i=0; i<8; i++) // Debug.Write((num & 1<<(14-i))>>(14-i)); // Debug.WriteLine(""); // for(int i=0; i<8; i++) // Debug.Write((num & 1<<i)>>i); // Debug.WriteLine(""); // } // //Debug.WriteLine(Convert.ToString(num, 2)); // num >>= 7; return((byte)(num)); }