LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Hex Value on DIO

Hello Ravens Fan,

 

Thankyou for your quick response Smiley Wink. 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 forumSmiley Happy

 

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 Kudos
Message 21 of 27
(740 Views)

So you just want to reverse the bits?

Message Edited by Ravens Fan on 03-02-2009 11:51 PM
0 Kudos
Message 22 of 27
(737 Views)

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 Kudos
Message 23 of 27
(729 Views)

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

 

 

0 Kudos
Message 24 of 27
(723 Views)

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 Kudos
Message 25 of 27
(714 Views)

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..Smiley Wink 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 Kudos
Message 26 of 27
(701 Views)
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.
Download All
0 Kudos
Message 27 of 27
(692 Views)