Data logging and Reading
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Data logging and Reading
Hi,
I need to log/store the data of measurements acquired from my micro-controller for further readings by the operator.
So far my readings for Four (4) parameters are working perfectly, therefore i need to modify my Vi design to store these four parameters as well. Please help me.
I need to log/store the data of measurements acquired from my micro-controller for further readings by the operator.
So far my readings for Four (4) parameters are working perfectly, therefore i need to modify my Vi design to store these four parameters as well. Please help me.
-
Eugen Graf
- guru
- Сообщения: 6502
- Зарегистрирован: 13 ноя 2007, 02:20
- Награды: 4
- Версия LabVIEW: 2009
- Откуда: Saarbrücken
- Контактная информация:
-
mzu2006
- doctor
- Сообщения: 2456
- Зарегистрирован: 16 авг 2008, 02:12
- Награды: 3
- Версия LabVIEW: 7.1 10 11 12
- Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
- Контактная информация:
Re: Data logging and Reading
noel_t,
it would be helpful, if you post your as well. For saving at the end, just add auto-indexing output tunnel on the left end of the while loop and
Set "Append to file" input as true.
it would be helpful, if you post your as well. For saving at the end, just add auto-indexing output tunnel on the left end of the while loop and
For logging (saving at intermediate points) just assemble your data into an array (using "Build Array") and connect resulting array to the input of the"Write to spreadsheet file".Eugen Graf писал(а):Connect your array to Write To Spreadsheet File
Set "Append to file" input as true.
Правила форума (Forum rules in Russian)
rm -rf /mnt/windows
rm -rf /mnt/windows
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
This is my .vi.
Please kindly help me to modify the necessary changes.
Please kindly help me to modify the necessary changes.
- Вложения
-
- Multi-channel Data Acquisition.vi
- Multi-channel data acquisition system based on PIC
- (20.45 КБ) 342 скачивания
-
mzu2006
- doctor
- Сообщения: 2456
- Зарегистрирован: 16 авг 2008, 02:12
- Награды: 3
- Версия LabVIEW: 7.1 10 11 12
- Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
- Контактная информация:
Re: Data logging and Reading
This is what I meant. Leave red part if you want to log as you go, or green part if you want to save final data.
- Вложения
-
- Clipboard02-m.png (8.32 КБ) 20289 просмотров
-
- Multi-channel Data Acquisition.vi
- (25.01 КБ) 438 скачиваний
Правила форума (Forum rules in Russian)
rm -rf /mnt/windows
rm -rf /mnt/windows
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
It's working perfectly and as the requirement of the project. Thanks a lot.
Now the only thing which lefts is to maximize the accuracy of this multi-channel data acquisition. By the way, the values which are shown in my LCD is like this (light=15.4 , Temp=30C, Voltage=12.4V, current= 2.3A). but in LABVIEW it only shows the the integer like this (light=15, voltage= 12 and ....)
Do you have any idea on how i can decimalize it. Since i am using PIC16F877A and it converts by 10-bit. But when i sent to through UART it becomes 8-bit only and affect the accuracy.
Basically what do you advise to do to maximize the accuracy? Any changes at the PIC code part?I can send you my pic code which is written in .c (Hi-tech compiler). Let me know if it helps.
***I just unchecked the localised decimal point in the option, and the result remained the same.(in LabView 2010)
i share some part of the PIC16F877A code (C Language, Hitech Compiler) which i think is related to ADC configurations and accuracy of the readings.
Now the only thing which lefts is to maximize the accuracy of this multi-channel data acquisition. By the way, the values which are shown in my LCD is like this (light=15.4 , Temp=30C, Voltage=12.4V, current= 2.3A). but in LABVIEW it only shows the the integer like this (light=15, voltage= 12 and ....)
Do you have any idea on how i can decimalize it. Since i am using PIC16F877A and it converts by 10-bit. But when i sent to through UART it becomes 8-bit only and affect the accuracy.
Basically what do you advise to do to maximize the accuracy? Any changes at the PIC code part?I can send you my pic code which is written in .c (Hi-tech compiler). Let me know if it helps.
***I just unchecked the localised decimal point in the option, and the result remained the same.(in LabView 2010)
i share some part of the PIC16F877A code (C Language, Hitech Compiler) which i think is related to ADC configurations and accuracy of the readings.
Код: Выделить всё
//--------------------------Light Sensor LDR
//sensor A //LDR
ADCON0=CHANNEL0;
lcd_goto(8);
read_adc(); ////This function generates the average reading value of ADC
light=read_temp(); ////This function stores the generated value by ADC into the variable "temp"
dis_num(light/10);
send_char('.');
dis_num(light%10);
putch(light/10);
//--------------------------Temperature Sensor LM35
//sensor B //LM35
ADCON0=CHANNEL1;
lcd_goto(28);
read_adc();
temperature=read_temp();
temperature = (temperature*0.48876);
putch(temperature);
dis_num(temperature);
//==================subroutine ADC=========================
void read_adc(void) ////This function generates the average reading value of ADC
{
unsigned short i;
unsigned long result_temp=0;
for(i=2000;i>0;i-=1) //looping 2000 times for getting average value
{
ADGO = 1; //ADGO is the bit 2 of the ADCON0 register
while(ADGO==1); //ADC start, ADGO=0 after finish ADC progress
result=ADRESH;
result=result<<8; //shift to left for 8 bit
result=256*result|ADRESL; //10 bit result from ADC
result_temp+=result;
}
result = result_temp/2000; //getting average value
}
unsigned short read_temp(void) ////This function stores the generated value by ADC into the variable "temp"
{
unsigned short temp;
temp=result;
return temp;
}
-
mzu2006
- doctor
- Сообщения: 2456
- Зарегистрирован: 16 авг 2008, 02:12
- Награды: 3
- Версия LabVIEW: 7.1 10 11 12
- Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
- Контактная информация:
Re: Data logging and Reading
localized decimal point has nothing to do with it. You transmit 8 bits only. Transmit more. Your code is hard to read (a lot of auxiliary stuff), but it appears to me that putch(temperature) - actually outputs 1 byte of temperature, right? So output both bytes now (low byte and 2 other bits in another byte) and change your LV software accordingly
Правила форума (Forum rules in Russian)
rm -rf /mnt/windows
rm -rf /mnt/windows
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
As you said, PIC16F877A is transmitting only 8-bits most probably because of following reasons:
1- UART is capable of transmitting data only 8-bits, and that's why as you said, people go for dividing the bits into two groups of lower and
higher to join them later not to affect the accuracy.
2- According to my ADC subroutine configurations in the code below, the pic ADC only take readings of 8-bit. I explained the reason in front of the code.
//==================subroutine ADC=========================
void read_adc(void) ////This function generates the average reading value of ADC
{
unsigned short i;
unsigned long result_temp=0;
for(i=2000;i>0;i-=1) //looping 2000 times for getting average value
{
ADGO = 1; //ADGO is the bit 2 of the ADCON0 register
while(ADGO==1); //ADC start, ADGO=0 after finish ADC progress
result=ADRESH;
result=result<<8; //shift to left for 8 bit
result=256*result|ADRESL; //10 bit result from ADC (As i assume over here,when we multiply 256 to the result of ADC (*256) it results to 8-bit reading, however basically, PIC16F877A is having a built-in 10-bit ADC. The reason i put like this, as i was facing difficulty with readings of current sensor,(ACS712-Hall Effect Sensor-not fair result) a friend adviced to use it, and he did not explained the reason, but anyhow the outcome was fair.
Just to add this, i don't think so putch command by itself output 1 byte of data. I think for any data to be sent through UART,it can not exceed than 1 byte.
Please let me know your comment.
1- UART is capable of transmitting data only 8-bits, and that's why as you said, people go for dividing the bits into two groups of lower and
higher to join them later not to affect the accuracy.
2- According to my ADC subroutine configurations in the code below, the pic ADC only take readings of 8-bit. I explained the reason in front of the code.
//==================subroutine ADC=========================
void read_adc(void) ////This function generates the average reading value of ADC
{
unsigned short i;
unsigned long result_temp=0;
for(i=2000;i>0;i-=1) //looping 2000 times for getting average value
{
ADGO = 1; //ADGO is the bit 2 of the ADCON0 register
while(ADGO==1); //ADC start, ADGO=0 after finish ADC progress
result=ADRESH;
result=result<<8; //shift to left for 8 bit
result=256*result|ADRESL; //10 bit result from ADC (As i assume over here,when we multiply 256 to the result of ADC (*256) it results to 8-bit reading, however basically, PIC16F877A is having a built-in 10-bit ADC. The reason i put like this, as i was facing difficulty with readings of current sensor,(ACS712-Hall Effect Sensor-not fair result) a friend adviced to use it, and he did not explained the reason, but anyhow the outcome was fair.
Just to add this, i don't think so putch command by itself output 1 byte of data. I think for any data to be sent through UART,it can not exceed than 1 byte.
Please let me know your comment.
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
Dear Mzu,
I really need your help to explain to me briefly how the program works, i am facing difficulty for preparation of technical report about that.
If it is possible give me some hints or structure that based on that i can collect information. It seems to me one or two paragraph in summary would be enough if i explain briefly and nicely.
Thanks in advance.
I really need your help to explain to me briefly how the program works, i am facing difficulty for preparation of technical report about that.
If it is possible give me some hints or structure that based on that i can collect information. It seems to me one or two paragraph in summary would be enough if i explain briefly and nicely.
Thanks in advance.
-
mzu2006
- doctor
- Сообщения: 2456
- Зарегистрирован: 16 авг 2008, 02:12
- Награды: 3
- Версия LabVIEW: 7.1 10 11 12
- Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
- Контактная информация:
Re: Data logging and Reading
Код: Выделить всё
result=ADRESH;
result=result<<8; //shift to left for 8 bit
result=256*result|ADRESL;
I would change the above piece of code to something like
Код: Выделить всё
result=(ADRESH<<8)|ADRESL;
Код: Выделить всё
short int value; // I assume 16 bit
putch(value>>8); // HIGH goes first
putch(value&255); // LOW goes second
Правила форума (Forum rules in Russian)
rm -rf /mnt/windows
rm -rf /mnt/windows
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
I think you got my meaning wrongly. what i meant was explanation about the application program u helped me to make as Multi-channel Data Acquisition.vi
i need to know that how the program works, i am facing difficulty for preparation of technical report about that.
If it is possible give me some hints or structure that based on that i can collect information. It seems to me one or two paragraph in summary would be enough if i explain briefly and nicely about this made LABVIEW program.
i need to know that how the program works, i am facing difficulty for preparation of technical report about that.
If it is possible give me some hints or structure that based on that i can collect information. It seems to me one or two paragraph in summary would be enough if i explain briefly and nicely about this made LABVIEW program.
-
mzu2006
- doctor
- Сообщения: 2456
- Зарегистрирован: 16 авг 2008, 02:12
- Награды: 3
- Версия LabVIEW: 7.1 10 11 12
- Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
- Контактная информация:
Re: Data logging and Reading
It assembles data to array and saves it to disk ... Post what you've written somebody might be able to pinpoint some obvious mistakes.noel_t писал(а):i need to know that how the program works, i am facing difficulty for preparation of technical report about that.
Правила форума (Forum rules in Russian)
rm -rf /mnt/windows
rm -rf /mnt/windows
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
Here is the only part that i don't understand the duty. Even though i went through the context help, but still can not sense the practical usage of this array. What does it do exactly at here.
- Вложения
-
- 9-20-2011 4-54-25 PM.jpg (30.84 КБ) 20127 просмотров
-
mzu2006
- doctor
- Сообщения: 2456
- Зарегистрирован: 16 авг 2008, 02:12
- Награды: 3
- Версия LabVIEW: 7.1 10 11 12
- Откуда: St-Petersburg (RU), Phila, Boston, Washington DC
- Контактная информация:
Re: Data logging and Reading
The selected "Index Array" function selects 0-th element of the array: light
Правила форума (Forum rules in Russian)
rm -rf /mnt/windows
rm -rf /mnt/windows
-
- beginner
- Сообщения: 12
- Зарегистрирован: 13 июл 2011, 09:50
- Версия LabVIEW: 2010
- Контактная информация:
Re: Data logging and Reading
If like this, therefore each array must accommodate 1 byte or 8-bits of data right?
1st array----------> Bit 0 to 7
2nd array..........>Bit 8 to 16
.
.
.
.
.and the same for the others two.
Is it correct what i think?
1st array----------> Bit 0 to 7
2nd array..........>Bit 8 to 16
.
.
.
.
.and the same for the others two.
Is it correct what i think?
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
- 5 Ответы
- 847 Просмотры
-
Последнее сообщение dadreamer