data = sockit_ltc2500_to_signed32( sockit_capture(client, NUM_SAMPLES, trigger=TRIG_NOW, timeout=0.0)) plt.figure(pltnum) pltnum += 1 plt.plot(data) plt.show() # Leave DAC set to arbitrary waveform generator client.reg_write(DATAPATH_CONTROL_BASE, datapath_word_lut_continuous) re_read_registers = False if re_read_registers == True: print('\nReading register block:') block = client.reg_read_block(REV_ID_BASE, 22) data_reg = block for i in range(0, 22): print(register_list[i] + ': %08X' % data_reg[i]) # Okay, now let's try writing to the DAC lookup table remotely! if (test_LUT_write == True): cDataType = ctypes.c_uint * 65536 cData = cDataType() print("Writing downward ramp to LUT!") for i in range(0, 65536): # Reverse ramp... cData[i] = (i << 16 | (65535 - i)) client.reg_write(DATAPATH_CONTROL_BASE, datapath_word_lut_continuous) client.reg_write(CONTROL_BASE,
print("** Tested Reg read and write. **\n") print("Testing reg write block") print 'Writing block of %d values to register location 0x%X...' % ( num_reg_writes, reg_address) last_location = client.reg_write_block(reg_address, num_reg_writes, reg_values, dummy) print 'Last location written into: 0x%X' % last_location if (last_location != (reg_address + (num_reg_writes - 1) * 4)): print 'ERROR in Reg Write Block. Returned wrong last location' print '** Tested reg_write_block. **\n' print("Testing reg read block") values = client.reg_read_block(reg_address, num_reg_writes, dummy) print 'Reading out block of %d values from register location 0x%X... ' % ( num_reg_writes, reg_address) print 'Values read out:' print values print '** Tested reg_read_block. **\n' print("Testing mem write") print 'Writing 0x%X to memory location 0x%X...' % (mem_value, mem_address) written_address = client.mem_write(mem_address, mem_value, dummy) if (written_address != mem_address): print 'ERROR in Memory Write. Returned wrong address.' print("Testing mem read") print 'Reading back memory location 0x%X...' % mem_address mem_value_read = client.mem_read(mem_address, dummy)
print '** Tested Mem read and write. **\n' # Testing reg write block if (verbose == True): print 'Writing block of %d values to register location 0x%X...' % ( number_of_writes, starting_address) last_location = client.reg_write_block(starting_address, number_of_writes, reg_values, dummy) if (verbose == True): print 'Last location written into: 0x%X' % last_location if (last_location != (starting_address + (number_of_writes - 1) * 4)): print 'ERROR in Reg Write Block. Returned wrong last location' error = error + 1 print '** Tested reg_write_block. **\n' # Testing reg read block values = client.reg_read_block(starting_address, number_of_reads, dummy) if (verbose): print 'Reading out block of %d values from register location 0x%X... ' % ( number_of_reads, starting_address) print 'Values read out:' print values print '** Tested reg_read_block. **\n' # Testing mem_write_block if (verbose == True): print 'Writing block of %d values to memory location 0x%X...' % ( number_of_writes, starting_address) last_location = client.mem_write_block(starting_address, number_of_writes, mem_values, dummy) if (verbose == True): print 'Last location written into: 0x%X' % last_location if (last_location != (starting_address + (number_of_writes - 1) * 4)):