LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous read and single write on serial port

have a look at the timing palette.

you can use the things in the comparison palette to compare/add/... timestamps


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 11 of 27
(2,026 Views)

As I am continuously receiving data that is why i did not put a wait inside the loop. So putting a case structure for write infront of the read loop might cause buffer overflow as serial data in continuously coming in.

0 Kudos
Message 12 of 27
(2,024 Views)

 

read-write-every-day.png

 

the input for the case structure is true when either "First Call?" is true or the current timestamp formatted as HHMM is equal to 1432.

your timezone or representation will differ so play with it,

use the highlight execution and probes, or just put the time part in a scratch VI and play with it.

 

regards

 

 

EDIT: a thought came to mind, you should definately also track (possibly shift register) whether you've run the WRITE for the day, because when the loop iterates faster than every minute, you will write more than once in that minute


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 13 of 27
(2,016 Views)

@sr_murd wrote:

As I am continuously receiving data that is why i did not put a wait inside the loop. So putting a case structure for write in front of the read loop might cause buffer overflow as serial data in continuously coming in.


If data in continuously coming in, you do not want to limit your loop rate with a wait.  The VISA Read will limit your loop rate (1 loop per message coming in).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 27
(2,014 Views)

Thanks jwscs,

 

I have tried using this method, but it keeps on sending more than once. the requirement is to

1) Send 25 at 4AM just once

2) Send 0 at 7AM just once

3) Send nothing at all other times.

0 Kudos
Message 15 of 27
(2,002 Views)

you have to figure out some things for yourself,

otherwise you will not learn.

 

read up on shift registers, and play in another VI with the time stuff so that you get the boolean to be true only at the times you want.

 

we will help you .. but can't do all your work for you.

 

ps. at the top of the forum are links for learning material, also searching for your problem in google/forum/labviews-help/labviews-examples will help you get better with labview.

 

if you can't do it in labview, at least write up an algorithm in pseudo code,

and we can go from there.

 

regards


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 16 of 27
(1,996 Views)

@sr_murd wrote: I have tried using this method, but it keeps on sending more than once. the requirement is to

1) Send 25 at 4AM just once

2) Send 0 at 7AM just once

3) Send nothing at all other times.


Use a Feedback Node and a Greater Than to prevent multiple sends (only send when the current value is TRUE and the previous value was FALSE).  I added some other logic to get both of your times in there.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 17 of 27
(1,992 Views)

HI jwscs

 

I have tried to make some logic, At the set time, it does send but its sending again and again.,and that also wrongly, if i send 31, it sends 31 at the specified time and also 1 in a separate string. If i send 25 , it sends 25 and also 5. i tried to use shift registers but could not try to apply in this case. can you please suggest for that? thanks a lot

 

 

Download All
0 Kudos
Message 18 of 27
(1,973 Views)

have a look at crossrulz post, he was so kind as to give you the solution

 

EDIT: and don't your eyes/brain hurt seeing all these strange wobbly wires?

try to make them a little less all over the place, as they hurt my brain 😉

 

EDIT2: the image in crossrulz post is a snippet, you can save the attached .png and then drag+drop it onto a block diagram


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 19 of 27
(1,971 Views)

Thanks for your kind response jwscs. I have even tried the program by crossrulz. It sends '0' as soon as i run it and then does not send anything at the specified times. Sorry for the wobbly wires Smiley Indifferent

0 Kudos
Message 20 of 27
(1,965 Views)