取消
顯示結果 
搜尋替代 
您的意思是: 

Sending Hex Value on DIO

Hello Ravens Fan,

 

Thankyou for your quick response 眨眼表情. I initialized the string shift register with an empty string and the old data disappeared after a stop and restart on that vi.

 

I love this forum高興表情

 

Hello All,

 

Can anyone help me with the problem in the above post where I require to write 40 bytes to the microcontroller in a reverse (little endian)  format e.g if I send AA55AA90 the data sent to the microcontroller should be 0955AA55. I need to send the data bit by bit so any suggestion for this will also be appreciated.

 

Thanks and Regards,

 

Nick

 

 

0 積分
21 條訊息(共 27 條)
1,207 檢視

So you just want to reverse the bits?

Message Edited by Ravens Fan on 03-02-2009 11:51 PM
0 積分
22 條訊息(共 27 條)
1,204 檢視

Hello Ravens Fan,

 

Yes. I use the same 1D array for inverting the bits. Please find attached Reverse bits.vi. Can I peroform the same operation with 40 bytes and send the data to the microcontroller?

 

Thanks and regards,

 

Nick

 

0 積分
23 條訊息(共 27 條)
1,196 檢視

Your life will be easer when you will use Array of U8.

 

 

0 積分
24 條訊息(共 27 條)
1,190 檢視

If you could use Array. It is easer.

 

I thing your communication protocol is status machine and it is not depend on time.

 

I attached my example. I did it by your clock.jpg schema. There missing:

--- Sending more  command - I thing you will do it.

--- You must handle error statues.

--- It is good add same waits to loops and between steps

 

Message Edited by JCC (SK) on 03-03-2009 12:10 PM
Message Edited by JCC (SK) on 03-03-2009 12:15 PM
0 積分
25 條訊息(共 27 條)
1,181 檢視

Hello JCC,

 

Thanks for your responses.You are correct my communication protocol is not time dependent.

I must say the vi you attached is impressive..眨眼表情 It is clean and good way of coding. I must learn these ways of coding.

What I do is just write a code without optimising it. From the earlier posts in this thread I have learnt how to combine errors, I will surely

do the same while finalisation of my code.

I too hope I could be able to use Array instead of a string. But as we were using a microcontroller based system with front end having String as an input for Users, I have to keep it the same way. I have attached an vi in which I am able to send multiple bytes using string. I know my code is messy. Still Please have a look.. My only worry is that I have to integrate this vi with my original code.

 

Thanks and regards,

 

Nick. 

0 積分
26 條訊息(共 27 條)
1,168 檢視
a) Don't use Property Node or Local Variable. It is not dataflow.

b) If you could use For loop with auto-indexing

c) Don't use Feedback node. It is hard to read. (Feedback is faster but is hard to read)

d) Use i "control" in For and While loop. You could not calculate index of loop 😉

e) when you same code call in loop more time and result is still same then move it to frond or rear of loop. (DAQmx Create Task, Start, Close Task)

f) I don't understand why do you use Main While Loop. You don't need Stop too. For loop will stop after all iteration.

See my modification of your code.
See how to convert Hex string to Array. After you could process everyone byte by For loop.
0 積分
27 條訊息(共 27 條)
1,159 檢視