terence Posted March 16, 2006 Report Share Posted March 16, 2006 hi guys, I'm trying to use labview (i'm a newbie to it) to establish a read and write data link to my microcontroller. at the moment i'm just outputting a constant character to com1 from my micro (AVR). i tried using the example that came with labview 7.1 (basic read and write) but i can't even run it. ii've attached the error i received. ANy ideas? Thanks Quote Link to comment
WMassey Posted March 16, 2006 Report Share Posted March 16, 2006 -1073807202 VISA: (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded It looks like you have not installed the VISA drivers (which will also include the definitons for the VISA error codes I believe - sort of a chicken & egg problem here - you cannot tell that a part is missing without the missing part). All of these address this same problem in one way or another: http://forums.ni.com/ni/board/message?boar...=171590#M171590 http://forums.ni.com/ni/board/message?boar...ry.id=0#M165490 http://forums.ni.com/ni/board/message?boar...ry.id=0#M119405 http://forums.ni.com/ni/board/message?boar...ry.id=0#M171528 and eventually, after you get VISA installed, this may be useful as well: http://forums.ni.com/ni/board/message?boar...=172286#M172286 Quote Link to comment
terence Posted March 21, 2006 Author Report Share Posted March 21, 2006 thanks for your help! i just installed the visa drivers, going to check it out now cheers Quote Link to comment
terence Posted March 21, 2006 Author Report Share Posted March 21, 2006 i've installed the drivers and the program runs for a few seconds before returning an error (see screenshot). i configured the micro to output a constant character 'b'. using tera terminal, i receive the characters correctly. but using labview i get a framing error. any ideas? Quote Link to comment
terence Posted March 21, 2006 Author Report Share Posted March 21, 2006 This is a really simple vi i put together just then to just display the characters that my microcontroller is inputting. a framing error occurs. any help is appreciated! Download File:post-4458-1142915071.vi Quote Link to comment
WMassey Posted March 21, 2006 Report Share Posted March 21, 2006 i've installed the drivers and the program runs for a few seconds before returning an error (see screenshot). i configured the micro to output a constant character 'b'. using tera terminal, i receive the characters correctly. but using labview i get a framing error. any ideas? A framing error usually results because you are using the wrong baud rate or bits per character or number of bits. It can also occur from noise on the communication link. Quote Link to comment
zero-tolerance Posted March 22, 2006 Report Share Posted March 22, 2006 I have experience with Microcontrollers and I had similar problems with it, specially the carrige return and line feeds. I programmed my microcontroller to have the carrige return and line feed but it beraly works in LabView, it must be somthing simple that I missed out as well, even though it worked fine in Hyperterminal. anyway, I have modified you program a little, this design worked for me, it might be the solution for you too. NOTICE: I have disabled the Carrige return, since that gave me a lot of problems, but with me it worked, even though theoratically to me it doesn't make sense. P.S You must get the Serial settings correct i.e. the baud rate, parity bit etc. just as WMassey mentioned. Download File:post-4068-1143025798.vi Quote Link to comment
WMassey Posted March 22, 2006 Report Share Posted March 22, 2006 The attached VI won't necessarily fix your framing error but it may allow you to read out complete messages from your microcontroller. The "bytes at serial port" function is a good way to tell when a message has started arriving at the serial port and it can even be used to determine when a nearly complete message has arrived (so you can avoid a timeout in the READ function) but the value that the "bytes at serial port" function returns is usually a BAD value to wire into the "byte count" input of the READ function, especially if you are using a read termination character, because the byte count value will limit the read to that number of bytes and no more. What you really want to do is this: define a read termination character enable the read termination character set a reasonable timeout value (higher baud rates = shorter times) periodically check the number of "Bytes at Serial Port" when the number of bytes at port look to be equal to (or slightly less than) the shortest-possible complete message then call the READ function Specify a "byte count" to the read function that is longer than the longest-possible message The READ function will return one complete message (or timeout if the message gets interrupted.) It works well. Try it. Download File:post-2800-1143043196.vi Quote Link to comment
terence Posted March 23, 2006 Author Report Share Posted March 23, 2006 thanks for all your help so far, i'm really appreciative! i played around with the program and was still receiving some junk instead of just the single character. i added in a delay and flush buffer before the bytes at port and receive the correct information. however this error occurs, and i'm not too sure what it means: Warning 1073676294 occurred at VISA Read in revised_bertserial2.vi Possible reason(s): VISA: (Hex 0x3FFF0006) The number of bytes transferred is equal to the requested input count. More data might be available. i've attached the modified vi. thx guys the baud rate im using is 57600 Download File:post-4458-1143084484.vi Quote Link to comment
WMassey Posted March 23, 2006 Report Share Posted March 23, 2006 i played around with the program and was still receiving some junk instead of just the single character. i added in a delay and flush buffer before the bytes at port and receive the correct information. however this error occurs, and i'm not too sure what it means:Warning 1073676294 occurred at VISA Read in revised_bertserial2.vi Possible reason(s): VISA: (Hex 0x3FFF0006) The number of bytes transferred is equal to the requested input count. More data might be available. the baud rate im using is 57600 The meaning of the message is that the READ function terminated on byte count (which is set to 999) rather than a termination character (which is set to <LF>, if you did not change the default ). And I'd have to say that if you can, 1) flush the buffer and 2) immediately get another 999 characters from the port, then you have got something wrong with the hardware or are listening to a device that sends continuously. But wait a minute, you did say it was outputting a "b" character over & over again. Are you seeing a bunch of bbbbbbbbbbbbbbb's? If it is still gibberish then you still are not using the correct communication parameters or else the microcontroller is not sending out a valid bitstream. You will have to figure out and fix either or both of these before we can help you further I think. If you are getting a bunch of bbbbbbbbbbbbbb's then I would expect this behavior from the LabVIEW code because it is expecting all valid messages to be terminated with a <LF> character and your controller is never sending one. Modify your controller's program to send a message like Hello<LF> and then retry the VI. Quote Link to comment
jpdrolet Posted March 23, 2006 Report Share Posted March 23, 2006 thanks for all your help so far, i'm really appreciative!i played around with the program and was still receiving some junk instead of just the single character. i added in a delay and flush buffer before the bytes at port and receive the correct information. however this error occurs, and i'm not too sure what it means: Warning 1073676294 occurred at VISA Read in revised_bertserial2.vi Possible reason(s): VISA: (Hex 0x3FFF0006) The number of bytes transferred is equal to the requested input count. More data might be available. i've attached the modified vi. thx guys the baud rate im using is 57600 The problem might also arise because after the serial port is init'ed, it can't identify the start bit correctly because of the continuous data stream. Change the program so it replies a finite number of characters after receiving a command. Continuous stream devices are more difficult to interface (they are evil!) because it is harder for both hardware and sofware to synch with the stream. Quote Link to comment
terence Posted March 27, 2006 Author Report Share Posted March 27, 2006 THanks Wmassey, you were right! i made the micro end a string with a <LF> character and now no errors occur while outputting to the VI. going to play with it more now! cheers Quote Link to comment
WMassey Posted March 27, 2006 Report Share Posted March 27, 2006 THanks Wmassey, you were right! i made the micro end a string with a <LF> character and now no errors occur while outputting to the VI. I'm glad that it is working for you now. And thanks for letting me know that I was able to help. :thumbup: Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.