ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bytes missing when using visa write in serial

I am using Visa write in serial communication

I read an arrray of text from a file and send it one by one through visa write

suppose statement one then new line char

next iteration statemnet2 new line character.

But some bytes are missing on the receiving end.

Is it a hardware problem or a speed problem.. I am not able to figure out..

0 Kudos
Message 1 of 5
(3,040 Views)

@su_a wrote:

Is it a hardware problem or a speed problem..


Yes.

 

No.

 

Maybe.

 

What do you mean by "send it one by one"? One by one what? Byte? Why would you do that? That's pointless. Also, if you're reading text from a file, it would already have new line characters, so why are you adding additional ones? You said some bytes are missing. Specific ones? Random? Every 10th? Every 100th? Please be specific. Showing some code would also help. You didn't do something silly like having the VISA Configure VI and VISA Close inside your loop, did you?

0 Kudos
Message 2 of 5
(3,034 Views)

The first new line character is because the script attached in the peripheral to COMPORT

Asks Enter to be pressed then only commands can be given at the command prompt.

Yes I am reading from a file but since I am using newline itself to extract the data from file as an array I have to write newline again.

By oen by one I mean each element of an array or each statement in the text file.

The configure visa and close are at the start and end of the main vi.

Earlier what was happening was suppose the commands in the file were

1)set base decimal

2)source "abc_scripts/Listen_commands.com"

statement 1 would execute

but statement two would come like this at the module which constantly reads from the COMPORT

CMD PROMPT> source "abcd_scripts/Lis_commands.com"
Cannot open file "abcd_scripts/Lis_commands.com" for input

Ten is missing from listen.

Once lis was missing from Listen

 

Now I have added delay after every statement. I started with 50 ms delay but 500-800 ms delay seems to work better and now the whole command is being written.

I am writing a general vi so I wanted to know the reason and not add a random delay.

Thank you for replying.

0 Kudos
Message 3 of 5
(3,020 Views)

Actually when I remove the delay, the first new line is also not registered so the command prompt never comes and the statements don't execute.

My half baked commands were coming when this write module was in debug mode hence there was an automatic delay.

fter putting the approx 800ms delay it is working fine but the reason is more important to me.

0 Kudos
Message 4 of 5
(3,013 Views)

Can anyone help?

0 Kudos
Message 5 of 5
(2,997 Views)