1
0
Fork 0
This commit is contained in:
YujinChu 2023-09-11 05:48:01 +00:00
parent c40e686cad
commit 5d42b474b6
2 changed files with 16 additions and 10 deletions

View File

@ -167,7 +167,7 @@ def cwt_thread(evt, chip_index, port_a_ai_id , port_a_do_id, port_b_ai_id , port
#prev_b_ai = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] #prev_b_ai = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
ai_array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ai_array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
random_index = random.randint(0, len(my_array) -1) random_index = random.randint(0, len(ai_array) -1)
ai_array = [random.randint(1,50000) for _ in range(16)] ai_array = [random.randint(1,50000) for _ in range(16)]
prev_a_ai = ai_array prev_a_ai = ai_array

View File

@ -162,12 +162,16 @@ def cwt_thread(evt, chip_index, port_a_ai_id , port_a_do_id, port_b_ai_id , port
#print("read thread get even") #print("read thread get even")
evt.clear() evt.clear()
prev_a_ai = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
prev_b_ai = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] #prev_a_ai = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
#prev_b_ai = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
ai_array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ai_array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
random_index = random.randint(0, len(my_array) -1) random_index = random.randint(0, len(my_array) -1)
ai_array = [random.randint(1,50000) for _ in range(16)] ai_array = [random.randint(1,50000) for _ in range(16)]
prev_a_ai = ai_array
prev_b_ai = ai_array
#value list on -> do control data #value list on -> do control data
#추<><ECB694>에 do power on 할 리스트는 어디선가 읽어서 와야 해요 #추<><ECB694>에 do power on 할 리스트는 어디선가 읽어서 와야 해요
#do1 do2 나눠야 해요 #do1 do2 나눠야 해요
@ -194,13 +198,14 @@ def cwt_thread(evt, chip_index, port_a_ai_id , port_a_do_id, port_b_ai_id , port
# PORT A # PORT A
port_a_do_value = list(b[:16]) port_a_do_value = list(b[:16])
try: try:
a_ai_data=port_A_AI.read_registers(0x32, 32) #a_ai_data=port_A_AI.read_registers(0x32, 32)
a_ai_data=ai_array
# suc_cnt_ai = suc_cnt_ai +1 # suc_cnt_ai = suc_cnt_ai +1
except: except:
isSuccess = False isSuccess = False
if isSuccess: if isSuccess:
prev_a_ai = ai_array priv_a_ai = ai_array
try: try:
port_A_DO.write_bits(0, port_a_do_value) port_A_DO.write_bits(0, port_a_do_value)
@ -211,8 +216,9 @@ def cwt_thread(evt, chip_index, port_a_ai_id , port_a_do_id, port_b_ai_id , port
# PORT B # PORT B
port_b_do_value = list(b[17:32]) port_b_do_value = list(b[17:32])
try: try:
b_ai_data=port_B_AI.read_registers(0x32, 32) #b_ai_data=port_B_AI.read_registers(0x32, 32)
prev_b_ai = ai_array b_ai_data = ai_array
#prev_b_ai = ai_array
# suc_cnt_ai = suc_cnt_ai +1 # suc_cnt_ai = suc_cnt_ai +1
except: except:
isSuccess = False isSuccess = False
@ -230,8 +236,8 @@ def cwt_thread(evt, chip_index, port_a_ai_id , port_a_do_id, port_b_ai_id , port
queue_a.put([timenow,ai_array, port_a_do_value]) queue_a.put([timenow,ai_array, port_a_do_value])
queue_b.put([timenow,ai_array, port_b_do_value]) queue_b.put([timenow,ai_array, port_b_do_value])
else: else:
queue_a.put([0,ai_array, port_a_do_value]) queue_a.put([0,prev_a_ai, port_a_do_value])
queue_b.put([0,ai_array, port_b_do_value]) queue_b.put([0,prev_a_ai, port_b_do_value])