How to read data from analog input and export it to a file using Components Works
I've made a simple application (Delphi 5 using the activeX) that read data from analog input channel 0. After I read the data, I want to export it to a file using the Components Works on a 6035E NIDAQ. (I'm not using labview and don't want to use it)
How can I do that???
Regards,
Francis
Here's a sample code to do this...
P.S.: If you read only one channel this code won't work.
function MyFunction: Integer;
var
Low, High, i, j, ChannelCount, RowCount: Integer;
Po: P;
begin
//you are reading multiple channel
ChannelCount := VarArrayHighBound(Buffer, 1);
RowCount := VarArrayHighBound(Buffer, 2);
for i := 0 to ChannelCount do begin
for j := 0 to RowCount do begin
WriteToDisk(Buffer[i, j]));
end;
end;
end;
Similar Messages
-
Hi everyone,
I am doing simple task in Visual C++ and I am using PCI-6221(37 pin).
Basically, I want to send same signal from 'analog input' to 'analog output'
at the same time (almost), to make it real-time application.
Can someone please provide me sample program.
I would appreciate if you could provide me with the good tutorial which explains
step by step everything about programing NI-DAQmx for C/C++.
Best Regards,
Khassan
Solved!
Go to Solution.This is my code in C++, you can optimize it if it looks too messy. This code reads signal from analog input and outputs it through analog output.
To make this code work additional include directories and library directories must be added from NI.
I hope it helps someone.
#include <stdio.h>
#include <conio.h>
#include "NIDAQmx.h"
#include <math.h>
#define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
int main(int argc, char *argv[])
int32 error=0;
TaskHandle taskHandleRead=0,taskHandleWrite=0;
int32 read=0;
float64 dataRead[1000];
char errBuffRead[2048]={'\0'};
char errBuffWrite[2048]={'\0'};
bool32 done=0;
int32 written;
DAQmxErrChk (DAQmxCreateTask("",&taskHandleRead));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandleRead,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleRead,"",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,0));
DAQmxErrChk (DAQmxCreateTask("",&taskHandleWrite));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleWrite,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleWrite,"ai/SampleClock",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk (DAQmxStartTask(taskHandleRead));
DAQmxErrChk (DAQmxStartTask(taskHandleWrite));
while( !done && !_kbhit() )
DAQmxErrChk (DAQmxReadAnalogF64(taskHandleRead,1,10,DAQmx_Val_GroupByScanNumber,dataRead,1000,&read,NULL));
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleWrite,read,0,10.0,DAQmx_Val_GroupByChannel,dataRead,&written,NULL));
_getch();
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuffRead,2048);
DAQmxGetExtendedErrorInfo(errBuffWrite,2048);
if( taskHandleRead!=0 )
DAQmxStopTask(taskHandleRead);
DAQmxClearTask(taskHandleRead);
if( taskHandleWrite!=0 )
DAQmxStopTask(taskHandleWrite);
DAQmxClearTask(taskHandleWrite);
if( DAQmxFailed(error) ){
printf("DAQmx Error: %s\n",errBuffRead);
printf("DAQmx Error: %s\n",errBuffWrite);
printf("End of program, press Enter key to quit\n");
getchar();
return 0; -
How to read data from a excel and HTML file
Hi
I am writing an 2D-array of string into Excel/HTML file using Report generation.
Can anybody tell me how to retrieve back the written data from the same files again and view in array format.
Thanks & regards
Visuman
Solved!
Go to Solution.you can use activex to read the data from the excel fileback in the array format...go through this vi...may b this will help you.........
Attachments:
Read Excel-1.vi 32 KB -
How to read data from SharePoint list and append to html table?
Hi All,
I would like to create custom view of SharePoint list, so want to append those sharepoint list items in a custom html table design using content editor webpart.
How to achieve this? thanks in advance!Content edit web part is not the right control. You can either Content Query Web Part
or Data view web part, where you need to modify xslt template using
SharePoint Designer and can render list data as per choice.
For Content Query Web Part:
Using the Content Query Web Part
Customizing the Content Query Web Part and Item Style
How to Customize SharePoint List Content Display using Content Query Web Part
For Data View Web Parts
Working with Data view Web Parts
Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer. -
How to read data from a CLUSTER STRUCTURE not cluster table.
Hi,
how to read data from a CLUSTER STRUCTURE not cluster table.
regards,
Usha.Hello,
A structre doesnt contain data.. so u cannot read from it. U need to find out table of that structure and read data from it.
Regards,
Mansi. -
How to read data from a file that was formatted by excel?
Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?
http://jakarta.apache.org/poi/hssf/index.html
HSSF stands for Horrible Spreadsheet Format, but it still works! -
How to read data from a connected modem
any one can help me? how to read data from a connected modem. The modem received real-time data from other server. The data is in text format. I can see this text when I used hyperterminal for dial up and the data is accumulated such as:
@aa1235678
@bb2135647
@cc5214367
since it is real-time data, I want to read one line each time instantly when it arrives.You need to use the Java Communications API. (http://java.sun.com/products/javacomm/index.html)
-
How to read data from an internal table into a real table?
Hello experts,
I'm relatively new to ABAP and I'm trying to figure out how to read data from an internal table into a table that I created. I'm trying to use the RRW3_GET_QUERY_VIEW_DATA function module to read data from a multiprovider. I'm trying to read data from the e_cell_data and e_axis_data tables into a table that I've already created. Please see code below.
TABLES MULTITAB.
DATA:
query_name TYPE RSZCOMPID,
s_cubename TYPE RSINFOPROV,
t_cell_data TYPE RRWS_T_CELL,
t_axis_data TYPE RRWS_THX_AXIS_DATA,
t_axis_info TYPE RRWS_THX_AXIS_INFO,
wa_t_cell_data like line of t_cell_data,
wa_t_axis_data like line of t_axis_data,
w_corp_tab like line of t_cell_data.
s_cubename = 'CORP_MPO1'.
query_name = 'Z_corp_test'.
CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
EXPORTING
i_infoprovider = s_cubename
i_query = query_name
i_t_parameter = query_string_tab
IMPORTING
e_cell_data = t_cell_data
e_axis_data = t_axis_data
e_axis_info = t_axis_info.
If anyone has any information to help me, I would greatly appreciate it. Thanks.Hi,
<li>Once you call the function module RRW3_GET_QUERY_VIEW_DATA, lets say data is available in the corresponding tables e_cell_data e_axis_data which you have mentioned.
<li>Modify your internal table defined for other purpose, with data from e_cell_data e_axis_data like below.
LOOP AT t_cell_data INTO wa_t_cell_data.
"Get the required data from t_cell_data.
MOVE-CORRESPONDING wa_t_cell_data TO it_ur_tab.
"Modify your internal table wih data
MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
ENDLOOP.
LOOP AT t_axis_data INTO wa_t_axis_data.
"Get the required data from t_cell_data.
MOVE-CORRESPONDING wa_t_axis_data TO it_ur_tab.
"Modify your internal table wih data
MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
ENDLOOP.
Thanks
Venkat.O -
Read data from E$ table and insert into staging table
Hi all,
I am a new to ODI. I want your help in understanding how to read data from an "E$" table and insert into a staging table.
Scenario:
Two columns in a flat file, employee id and employee name, needs to be loaded into a datastore EMP+. A check constraint is added to allow data with employee names in upper case only to be loaded into the datastore. Check control is set to flow and static. Right click on the datastore, select control and then check. The rows that have violated the check constraint are kept in E$_EMP+ table.
Problem:
Issue is that I want to read the data from the E$_EMP+ table and transform the employee name into uppercase and move the corrected data from E$_EMP+ into EMP+. Please advise me on how to automatically handle "soft" exceptions in ODI.
Thank youHi Himanshu,
I have tried the approach you suggested already. That works. However, the scenario I described was very basic. Based on the error logged into the E$_EMP table, I will have to design the interface to apply more business logic before the data is actually merged into the target table.
Before the business logic is applied, I need to read each row from the E$EMP table first and I do not know how to read from E$EMP table. -
Help me, How to read data from USB ???
Help me, How to read data from USB ???
If its a disk on key or some portable hard drive than once its connected to the usb and recognized by the system you can access it through java like you would access your hard drive.
-
How to retrieve data from catsdb table and convert into xml using BAPI
How to retrieve data from catsdb table and convert into xml using BAPI
Points will be rewarded,
Thank you,
Regards,
Jagrut BharatKumar ShuklaHi,
This is not your requirment but u can try this :
CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
GRANT READ ON DIRECTORY text_file TO fah;
GRANT WRITE ON DIRECTORY text_file TO fah;
DROP TABLE load_a;
CREATE TABLE load_a
(a1 varchar2(20),
a2 varchar2(200))
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY text_file
ACCESS PARAMETERS
(FIELDS TERMINATED BY ','
LOCATION ('data.txt')
select * from load_a;
CREATE TABLE A AS select * from load_a;
SELECT * FROM A
Regards
Faheem Latif -
How to read data from table GLFUNCA quickly?
Hello everybody!
Recently,my colleague has programmed a report about reading data from table GLFUNCA,and its speed is very slowly and exceeded limited time sometimes .
Excuse me?
how to use INDEX and VIEW TO accelerate it?
pls supply my helpful solutions.
Thanks!
Best wishes!Hi,
Please check your SELECT statement to find out what are the columns being used in the WHERE clause. Then go to SE11 and find out if there are indexes on those columns.
If Indexes don't exist then you can create indexes on those columns, which might improve the performance.
However, there might be other areas also, where the performance can be improved. Do a run time analysis / trace and figure which part of the program is taking maximum time.
Regards,
Ravi
Note : Please mark the helpful answers -
JTable, how to read Data from it when enter is pressed
How to read Data from JTable on Return or lost focus from cell.
Also please tell me which listener I should should.
thx for helpYou should read the tutorial about tables, cell editors and models.
Also you should not [url http://forum.java.sun.com/thread.jsp?thread=472677&forum=57&message=2186815]crosspost
Mike -
How to read data from a router by using labview
I am a beginner labview. How to read data from a router by using labview ?
What kind of data are you trying to read?
Does the router behave like a webserver that you log into? If so, search the forums for threads discussing HTML. -
How to read data from a zipped MS Access file?
How to read data from a zipped MS Access file?
RPJ,
You do not need to use the Close Zip File.vi when you unzip a folder. This VI is used when you are creating a zip folder.
As for examples, I found a couple of ActiveX based MS Access examples. These programs look to be pretty basic. For more in depth example I would search Microsoft Developers Network
http://zone.ni.com/devzone/cda/epd/p/id/2188
http://zone.ni.com/devzone/cda/epd/p/id/1694
Regards,
Jon S.
National Instruments
LabVIEW R&D
Maybe you are looking for
-
How many users can access networked itunes at one time?
So we've got an Apple Extreme router and I've plugged a hard-drive in the back which has both our itunes & iphoto libraries on it. The idea being that all 3 of our mac laptops can use one networked library. However we are finding that only one mac ca
-
Problem in running animation in forms runtime , can any body help me
Hi, I did a small project using forms 6I . When I run my project the first cansvas named Welcome Screen will be displayed. I.e this is the first canvas displayed. Now my problem is : In that WelcomeScreen canvas I placed a OLE object and inserte
-
Combine several pdf docs into one single pdf doc
I need to combine several pdf's into one pdf. How can I do this?
-
CRIO Doesn't Show Up In The Distributed Systems Manager
All, Any idea why my cRIO wouldn't show up in the distributed systems manager? I'm running Real Time 3.2.1 and I've already deployed my shared variables. I can see the cRIO through MAX and with my project just fine. - Ken
-
"dynamic" String concat in Expression language
I would like to do something like (in Java) String s = flag? "this" : value + "that";in EL it would be #{flag ? 'this' : value + 'that'} but this leads to an error because it tries to add as numbers and not concat as strings. how can I do this? thank