03-07-2010 04:10 AM
Hi everybody,
can anyone help me to transfer an image file to another PC through Labview through serial port?
I tried using IMAQ functions to decode the image to a string. but there is a problem at the receiving end to get back the image.
is there any easy way to just sent and receive an image file through serial port??
Thanking you in advance.
shanaka
Solved! Go to Solution.
03-07-2010 01:03 PM
03-10-2010 03:40 AM
Thank you very much for your help....i guess i don't have to go to IMAQ functions for just to copy an image file from one PC to another through serial.i read and write the file as binary. but there is a limitation for that.if the file size is more than 10KB then it will not work.
is it because of not synchronizing the transmitter and receiver? i will add my reader.vi and write.vi for your consideration.
please there will be a lot of errors in programming side because i'm still new to labview.
by the way i don't know how to give kudos, n i rated you as 1.how to increase the rating?
thanks,
regards
shanaka
03-10-2010 06:51 AM
thanks for the kudo, you can only give one per userid.
If I supply the accepted solution you can click on that button.
I'll look at your vi's tonight.
It probably is nicer for the serial line to set up a bit of handshake.
send 10k, and wait for an acknowledgement from the other pc., something like send new data.
On the receiver side you have to add all the received characters until complete and then unflatten again.
Don't try to unflatten partly data, it does not work.
03-10-2010 04:59 PM
You do very well for a beginner in LabVIEW.
Your solution in sending a file and saving a file romves the problem from flatten to and unflatten from string.
You may add a specification for the first write in how many blocks you write. Say one word extra, for the number of blocks.
Furthermore I personally never use waituntil next ms multiple, most important reason that you cannot trust the first wait, and second I don't want all waits to hogg the cpu at the same time.
Also file handling can be a bit cleaner but is OK.
I would not check filesize against a constant but received bytes against expected size.
I'll try to find some time to clean up the diagrams, maybe tomorrow.
03-11-2010 02:25 AM
thank you Mr.Albert for giving me such advices. its really nice to get advices from a person like u.i will try using flatten to and unflatten from string.and also il try to include a handshake after every 10KB. that constant file size was i just put there to check... and forgot to remove it before sending it to you.i get the first 4 bytes to read the size of the file and then take that size to the receiver end.
i will complete those problems and update you.thank you for your time.
regards,
shanaka
03-11-2010 01:54 PM
Hi
I like people that like to learn. Thank you for listening.
I modfied both read and write subvi's because I beleive in keeping it simple and the straighter the wires the better readable the program and less bugs remain.
Even better, wtith straight lines my eyes don't get tired too soon.
good luck with your program.
03-12-2010 01:15 AM
Hi albert,
thank you for modifying my VIs, yeah now those are working properly and also looking good.but i should include handshaking and also have to increase the buffer size.i found if the file is not divisible by the buffer size then receiver will not get the whole file.so i guess i need to add some dummy bytes to get the file divisible by the buffer size and transmit. i will make it working properly and contact you.
Thanking you,
Regards,
shanaka
03-12-2010 02:54 PM
03-22-2010 08:07 AM
Hi Albert,
once again i need your help...
now i have developed that reader/writer VIs using Xmodem protocol for a reliable communication. and now i have another issue.say if my transmitter side connection is lost,so how do i detect it from the transmitter side and pause the transmission until the link is ready?
i simulated the scenario by using a pause in transmitter side.but now i need to detect the serial connection from the transmitter side.
it would be grateful if you can give me any kind of advise to do this.
thanking you,
regards,
shanaka