11-18-2015 06:01 PM
I have been working with recieving serial data via uart to labview parsing that data to reconstruct a AC signal then doing analysis on that signal to get amp and phase. The phase is incorrect cause of no time reference im working on that so for now im just using the tone measurment function to get a phase from my data. Then after that i want to write these measurments back to my PIC. My micro expects the values to be formated as follow.
A123P123
when my micro detects an "A" it knows the amplitude, and "P" for phase so im using the "format into string" to append the "A" and "P" to the amplitude and phase values.
My question is can i use the visa write in the consumer loop like the attached picture of my code while i have the visa read in the producer. Also will the format into string work.
11-19-2015 09:14 AM
For what I am seeing in your code you are getting data (that you need to analyze) and then write it to your PIC, if so, then I do not think that what you are doing is wrong. You are reading your data enqueuing the data, then you analize and write that analized data to you PIC usign VISA Write (with a strig due VISA write needs a string as a write buffer).
I am adding some links for you about P/C architectures that you can use as example to help you with yours:
http://www.ni.com/white-paper/3023/en/ (Producer/Consumer design)
https://decibel.ni.com/content/docs/DOC-22047
https://decibel.ni.com/content/docs/DOC-2431 (this eventhoug is used with DAQmx it has pretty much the same thinking as yours: Read then write)
ftp://ftp.ni.com/pub/events/labview_dev_ed/2009/labview.pdf (info)
Hope this will help you
11-20-2015 02:11 AM
I cant seem to get the correct values for the Frequency, amplitude, and phase. I am just getting bits of a number for some reason. The result string seems to be in the format i expect but not the correct values. You can see in the image the result string and actual values i expect to write to uart.
11-20-2015 04:29 AM
11-20-2015 09:36 AM
sorry i added the frequency as well so the micro expects the following order of the data.
P#F#V# where # is the number not any special character.
When micro dectects P it knows the phase
F = frequency
V = Voltage.
I just have the wrong wires going into the wrong spot then the picture the Phase and Frequency are mixed up that why i arranged the frequency then phase, and voltage under the result string so the P is actually getting the frequency and so on. Not anything that messing up the code. I also cut numbers after decimal. So the string should be getting the numbers underneath but is not i dont know if its the format to string function or if i shouldnt being wiring the components of of extract tone function the way i am into the format string function.
11-20-2015 11:41 AM - edited 11-20-2015 11:42 AM
You aren't cutting any decimals in this version. What did you do with the version that shows the numeric results and the string? Does the micro expect a termination character? You aren't sending one.
11-20-2015 12:17 PM
Here is that verison. the micro sends data then labview analyzes it and then sends it back and the micro waits for the interrupt to display the voltage,freq,phase on the lcd it wont release data again until the interrupt is enabled each time
When i use constants on the format string for some reason the micro likes that and will display it and work as i like.
11-20-2015 12:38 PM
Front panel
11-20-2015 01:03 PM
11-20-2015 02:03 PM
okay but besides that either way when i am sending those measurment back to my micro,they wont show and my micro wont recognize it. Although if intead of wiring the components from the "Amp-freq single tone function" to the "format string function" just use constants on the "format string function" my micro detects that and writes that to the lcd.
My question is why doesnt the values from the amp-freq single to the "format string" function go through to the micro and the constant do.
Does that make sense???