ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
04-25-2012 06:51 AM
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..
04-25-2012 07:41 AM
@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?
04-25-2012 11:31 PM
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.
04-26-2012 12:38 AM
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.
04-27-2012 03:31 AM
Can anyone help?