02-19-2007 03:35 PM
02-19-2007 03:41 PM
02-19-2007 03:57 PM
02-20-2007 06:52 AM
02-20-2007 07:19 AM
@AleksF wrote:
The parameters of the Serial interface are: Baud Rate: 9600 ; Stop Bits: 1; Data Bits: 8; Parity: None; Flow Control: None. I´m using a USB-RS232 Converter to been able to connect my acquisition card with my laptop.Thanks again...
02-22-2007 04:07 PM
Thanks to Craig and Centerbolt, i appreciate so much your interest in my problem...
Well, in fact I´m assuming that the PIC is providing the flow control because the transmission buffer isn´t empty until the stop bit is transmitted, if I eliminate the routine of the servo motor and the PIC only performs conversions and transmission of the data, I perfectly receive the exact number of bytes that I´m expecting.
When the servo routine is executed by the PIC, It doesn´t transmit anything, so I have blocks of 8 bytes at the serial port every 50 ms aprox, I´m a little newbie working with the RS232 protocol but as far as i know, the serial port is configured to receive the data when detects an start bit and validate the byte when the stop bit is detected. So, maybe I´m wrong, but there´s no possible that the buffer fills with garbage during that period of 50 ms.
On the other hand, Do you think that i can solve my problem if the VISA read block is inside of a while loop and stop the loop when the byte count is equal to the number of bytes that I expect?
If you have any comment or hint about this, please let me know and again thanks so much for your answers...
Regards
02-23-2007 06:55 AM
AleksF,
You have enabled the termination character on the "VISA Configure Serial Port.vi". It defaults to enabled with a LF as the character when left unconnected. Make sure that this is what you really want and make sure your PIC is transmitting the correct termination character back to your LabView program. Does the data that you do receive make sense?
02-23-2007 09:51 AM
Hi Centerbolt, yesterday I had time to work again with the card, as I comment before, when I eliminate the motor routine, all works fine, the data that I´m receiving has sense since I connect a known voltage to each analog channel and thats what I´m receiving on the screen. I attach an image of previous results that i´m obtained with this card and the program that I show you before. This VI isn´t detailed so I apologize for the appearance of the front panel.
The first image shows the behavior of the interface when I connect 3 channels to ground and the last one to a sine wave from a functions generator. The second is a caption of the screen of the oscilloscope showing a 8 byte pack transfered by the PIC, the TTL signal is measured at the output of the PIC and the RS232 signal is measured at the output of the MAX232 which converts the TTL signal to RS232 protocol.
The info in the screens is in spanish so if you have any doubt about it, please let me know. Sorry if my english is not good enough...
I´m going to check the termination character...On saturday I have time to continue with the tests so if I found something I´ll notify you as soon as possible.
Note: the test in the image is with only 200 measures instead of 900, but is the same case for 900 measures (I can receive all if the servo routine is eliminated)
Thanks for all Centerbolt!
02-23-2007 10:08 AM
If everything works with the motor not running, that is a good start. First it means that your PIC is definitely transmitting at the correct BAUD rate and that it is capable of sending all the data. Second it points to a couple of possible problem areas.
1 - The problem could be timing related. With the motor routine removed, did the PIC still have a delay between reading the channels?
2 - It looks like you got good data when the motor was not running. What happens if the motor is running? Does the data you get make any sense? If the data received with the motor running makes no sense, the problem could be electical noise created by the motor interfering with the RS-232 communications. Either way you should verify with your oscilloscope that the signals remain correct when the motor is running.
02-23-2007 12:56 PM