Count 4th consecutive pulses from the analog output of the encoder
Hi
Iam getting analog output from the encoder and i want to count the 4th peak of the analog signal. Kindly suggest the best method Once 4th pulse is detected counter will increments.
Pl refer the encoder output .
Thanks
Attachments:
encoder sig.JPG 26 KB
Whatever you've counted using your logic, divide it by 4 and convert it to an integer (towards negative infinity)..!!
This should work.
I am not allergic to Kudos, in fact I love Kudos.
Make your LabVIEW experience more CONVENIENT.
Similar Messages
-
I am using the PCI-7344 to control my system. The analog inputs are connected to the output of my system while the analog outputs serve as feedback to the system. The system is a servo. I want to know what is the conversion between the voltage read at the input, to card counts, and finally to the voltage output to the system.
Carole,
If you are trying to do analog feedback with a servo motor, Chapter 14 of the manual talks about how to set up the torque feedback. Also linked below is a LabVIEW example of analog feedback.
Chapter 14
NI-Motion User Manual
Automatic Analog Feedback with FlexMotion example
A. Talley
National Instruments -
PCI Card for Analog output in the range of 10mv
dear ni,
I want to know about the PCI card that can be generate analog output in the range of maximum 10mv. i am going to use for caliberation of loadcell, strain gauges devices.
could you tell me on which PCI card will support this type of application.
Regards,
Balaji DPTry: http://www.ni.com/dataacquisition/
These have analog output voltages < 10V: http://sine.ni.com/nifn/cds/view/main/p/sn/n12:7604,n3:7853/lang/en/nid/1036/ap/daq
You need something with a high bit count to get good resolution at 10 mV, such as the PCI-6010 which has a 16 bit D/A.
Here are the minimum voltage specs for the 6010:
Minimum Voltage Range
-0.2..0.2 V
Range Accuracy
283 µV
Range Sensitivity
6.4 µV
Message Edited by vt92 on 11-18-2009 07:56 AM
"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal -
Using analog output in the background
Hi,
I need to use the analog output channel on a NI PCIe-6351 to play an audio signal, and while the signal plays i need make some changes the UI dialog box, is it possible for me to move the playing of the audio to the background and proceed with program execution?
Here is a simple piece of code that explains what I'm trying to do:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<memory.h>
#include<wchar.h>
#include "sndfile.h" //include file for the sound library
#include "NIDAQmx.h"
#define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
float *fWavSample;
SNDFILE *SoundFile;
SF_INFO SoundFileInfo;
int iNoOfSamples=0;
int32 error=0;
TaskHandle AOtaskHandle = 0;
float64* AIOSample;
char errBuff[2048]={'\0'};
int32 fnCreateTask(TaskHandle *AOTaskHandle)
int32 error=0;
DAQmxErrChk(DAQmxCreateTask("", AOTaskHandle));
Error:
return error;
int ReadWavFile()
//Open the wav file for reading
SoundFile=sf_open("sin_10s.wav",SFM_READ,&SoundFileInfo);
//Check if file is opened sucessfully
if (SoundFile == NULL)
puts("File not opened");
return FALSE;
//allocate memory for the buffer that is to hold the wav data:
fWavSample = new float[SoundFileInfo.channels * SoundFileInfo.frames];
iNoOfSamples = SoundFileInfo.channels * SoundFileInfo.frames;
//Read data into the float structure that has been copied in
sf_readf_float(SoundFile, fWavSample, SoundFileInfo.frames);
//Allocate memory for the structure that is to hold the sound samples
AIOSample = new float64[iNoOfSamples+660];
//Copy wavefile data into the new float64 array (needs to be typecasted to float64)
int i=0;
for(i=0;i<(SoundFileInfo.channels * SoundFileInfo.frames);i++)
AIOSample[i] = (float64)fWavSample[i];
//After the float64 array has been filled, release the memory used by fWavSample
free(fWavSample);
return 0;
int main(int argc, char** argv)
DAQmxErrChk(fnCreateTask(&AOtaskHandle));
//Create an analog out channel
DAQmxErrChk (DAQmxCreateAOVoltageChan(*(&AOtaskHandle),"Dev1/ao1","",-10.0000000,+10.00000,DAQmx_Val_Volts,NULL));
//16 bit output resolution needed, sampling rate matched to the WAV file's
DAQmxErrChk (DAQmxCfgSampClkTiming(AOtaskHandle,"",44100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
//Set the output to trigger on a rising edge on PFI6
//DAQmxErrChk (DAQmxCfgDigEdgeStartTrig (AOtaskHandle,"PFI6",DAQmx_Val_Rising));
//Start the task in the background
DAQmxStartTask(AOtaskHandle);
ReadWavFile();
DAQmxErrChk(DAQmxWriteAnalogF64(AOtaskHandle,(SoundFileInfo.channels * SoundFileInfo.frames),true,10.0, DAQmx_Val_GroupByChannel,AIOSample,NULL,NULL));
printf("Playing audio\n");
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
//puts(errBuff);
puts(errBuff);
return TRUE;//DefWindowProc(hwndmon,message,wParam,lParam);
getch();
The program reads a 10 seconds long 1kHz sine wave signal from a WAV file and plays it over AO0.
I want the program to print "Playing Audio" on the console window while the audio is still playing, i.e when DAQmxWriteAnalogF64 is executing.
I'm using Visual Studio 2005 on Windows XP and an NI PCIe6351.
I'd really appreciate any help I can get.
Thanks a lot!
RaziMHi RaziM,
It sounds like you will need to implement some sort of multithreading to accomplish playing audio in the background and also making changes in the UI dialog box in the foreground. Since DAQmx is thread safe this should definitely be possible, but it will probably take a little more work on your part.
You may want to take a look at this page which gives a walkthrough to Multithreading with a Background component, http://msdn.microsoft.com/en-us/library/ywkkz4s1.aspx
Here is another forum post about how DAQmx runs multiple threads, http://forums.ni.com/t5/Measurement-Studio-for-VC/DAQmx-how-does-it-multithread/td-p/221953
I hope some of this helps!
Rachel M.
Applications Engineer
National Instruments -
Where do I find a TosLink, Optical to Analog Audio for the Optical Output on the Apple TV 2?
click here for information.
-
PC able to detect all except for the analog output channel of my SCB-68 device.
I would like to use the analog output channel of my SCB-68 device. I tried to locate the analog o/p using the wizard but still unable to detect. Why is that so?
Any possible steps/procedure that i have missed out?
ThanksRezn,
Aha, therein lies the problem. This was what I suspected, and thus my question as to which data acquisition card you are using. The DAQCard-AI-16XE-50 has analog inputs, digital I/O, but no analog outputs at all. So your card is working as it should, but it has no analog outputs.
If you have the 2002 National Instruments catalog, you can see this in a table on page 231 (your DAQ card is the one on the bottom), or check this pdf file:
http://www.ni.com/pdf/products/us/2mhw254-255e.pdf
Your card is also called the NI6012E. Check out the small table on the first page.
Mark -
Hi All,
i have used CMS in SQL 2008 R2. i have added couple of servers in its group. i have executed a query & i need to send the query output in the form of email.
basically query is checking the rows count from couple of user tables in servers.
issue here is how to copy the data that is used by CMS? i need to work on automate the rows count in difft user table in db servers
could you please suggest how can i achieve this?Copy to what?
SELECT COUNT(*) FROM sys.objects
Running the above statement returns two columns (server name and count)
All the servers SS2005 and onwards , then use
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'name',
@recipients = '[email protected]',
@query = 'SELECT COUNT(*) FROM sys.objects',
@subject = 'Count rows'
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How to write the code to send the report output to the local file.
dear all,
how to write the code to send the report output to the local file.
Thanks & Regards,
Jyothi.Hi,
Try this , it will display report and download the file as well. Just vhange the path and execute
TYPE-POOLS : SLIS.
DATA : IT_SCARR TYPE TABLE OF SCARR,
IT_FCAT TYPE SLIS_T_FIELDCAT_ALV.
SELECT *
FROM SCARR
INTO TABLE IT_SCARR.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
* I_PROGRAM_NAME =
* I_INTERNAL_TABNAME =
I_STRUCTURE_NAME = 'SCARR'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_INCLNAME =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = IT_FCAT
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME =
* IS_LAYOUT =
IT_FIELDCAT = IT_FCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_SCARR
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
* BIN_FILESIZE =
FILENAME = 'C:\Documents and Settings\sap\Desktop\Hi.xls' " Change path
* FILETYPE = 'ASC'
* APPEND = SPACE
* WRITE_FIELD_SEPARATOR = SPACE
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = SPACE
* WRITE_LF = 'X'
* COL_SELECT = SPACE
* COL_SELECT_MASK = SPACE
* DAT_MODE = SPACE
* CONFIRM_OVERWRITE = SPACE
* NO_AUTH_CHECK = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = SPACE
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
CHANGING
DATA_TAB = IT_SCARR
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* NOT_SUPPORTED_BY_GUI = 22
* ERROR_NO_GUI = 23
* others = 24
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = 'C:\Documents and Settings\sap\Desktop\Hi.xls' "Change path
* APPLICATION =
* PARAMETER =
* DEFAULT_DIRECTORY =
* MAXIMIZED =
* MINIMIZED =
* SYNCHRONOUS =
* OPERATION = 'OPEN'
* EXCEPTIONS
* CNTL_ERROR = 1
* ERROR_NO_GUI = 2
* BAD_PARAMETER = 3
* FILE_NOT_FOUND = 4
* PATH_NOT_FOUND = 5
* FILE_EXTENSION_UNKNOWN = 6
* ERROR_EXECUTE_FAILED = 7
* SYNCHRONOUS_FAILED = 8
* NOT_SUPPORTED_BY_GUI = 9
* others = 10
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
What is the AC output for the orgnal charger for Camelio x100?
hi,
I lost my ac adapter for my Camelio X100 camera. I want to know the AC output for the orignal adapter because I need to buy a new one.
Please if you have same camera model (Camelio X100) just take a look for PC adapter and tell me how much ouptu volt and output Amp ?
Best RegardsYou should archive the material in it's native format so that you have the possibility to revisit the project and make changes or generate master files in other formats.
Use the Media Manager to consolidate your project into a single enclosing folder. This can be compressed into a .zip file or disk image. It will save space if you dont include render files, even more if you make the material that came from tape, offline -although you will have to recapture in that case. -
User Defined Field that gives the date output of the last price update.
We would like to create a User Defined Field (UDF) with a Formatted Search (FMS) on the Item Master form that gives the date output of the last price update specifically the wholesale price.
Last Price Update
Pricelist 2 = Wholesale
Is this feasible?
If it is feasible what is the recommended approach?
Current working UDF on Item Master.
/* Date output is based on all the latest updates on the Item Master.*/
select max(updatedate)
from aitm
where itemcode = $[oitm.itemcode]
Resources that were helpful.
1.(Note:1165947 - Tracking Item Price Changes.)
2. Case 4-I6: Query on price updates. Mastering SQL Queries for SAP Business One By: Gordon DuThank you Gordon,
We are looking for the date output of the 'Last Price Update' based on 'Pricelist 2 = Wholesale' which is the challenge.
These 2 are the parameters for the date output, I should have mentioned that in my original message.
Last Price Update
Pricelist 2 = Wholesale
Per reading a bunch of other similar Forum Questions it looked like it is might not be possible to do. With there being no date on the AIT1 table and AITM.Updatedate is based on any and all updates not just last 'Last Price Update' and not sure how to use the loginstanc.
Thanks,
Vern -
How can I write the analogous code to the logic:iterate tag functionality
Hai This is Rayalu .And I am very new to the Java World. I have a doubt?.How can I write the analogous code to the<logic:iterate> tag functionality using the JSP Tag Libraries . Pleae Send me some examples .
Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How to send the spool output to the specific user during ALE distribution
Hi All
In ALE internal order Configuration done by BAPI Method SAVEREPLICA Business object BUS2075whenever user changed the internal order which is moved to the destination system because of change data setting in data element fields.
I want to know how to send the spool output of the changed internal order to the specific user during ALE distribution.
Please help me to reslove the above issue
Thanks & Regards
KRISHGUNASolved by myself
-
How to put the alv output into the spool request?
Hi guys,
How to put the alv output into the spool request?
Thanks!Hi
Sending an ALV List screen output to SPOOL
Convert ALV list to PDF and send mails to respective persons
Regards
Pavan -
How to send the report output to the application server in a excel file
Hello,
how to send the report output to the application server in a excel file.
and the report runs in background.
Thanks in advance.
SundeepDear Sundeep.
I'm providing you with the following piece of code ... Its working fine for me ... hopefully it suits your requirement ...
D A T A D E C L A R A T I O N *
TYPES: BEGIN OF TY_EXCEL,
CELL_01(80) TYPE C,
CELL_02(80) TYPE C,
CELL_03(80) TYPE C,
CELL_04(80) TYPE C,
CELL_05(80) TYPE C,
CELL_06(80) TYPE C,
CELL_07(80) TYPE C,
CELL_08(80) TYPE C,
CELL_09(80) TYPE C,
CELL_10(80) TYPE C,
END OF TY_EXCEL.
DATA: IT_EXCEL TYPE STANDARD TABLE OF TY_EXCEL,
WA_EXCEL TYPE TY_EXCEL..
E V E N T : S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Here you populate the Internal Table.
Display - Top of the Page.
PERFORM DISPLAY_TOP_OF_PAGE.
E V E N T : E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
SET PF-STATUS 'GUI_STATUS'.
E V E N T : A T U S E R - C O M M AN D *
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'EXPORT'.
Exporting the report data to Excel.
PERFORM EXPORT_TO_EXCEL.
ENDCASE.
*& Form DISPLAY_TOP_OF_PAGE
text
--> p1 text
<-- p2 text
FORM DISPLAY_TOP_OF_PAGE .
SKIP.
WRITE: /05(128) SY-ULINE,
/05 SY-VLINE,
06(127) 'O R I C A'
CENTERED COLOR 1,
132 SY-VLINE.
WRITE: /05(128) SY-ULINE,
/05 SY-VLINE,
06(127) 'Shift Asset Depreciation - Period/Year-wise Report.'
CENTERED COLOR 4 INTENSIFIED OFF,
132 SY-VLINE.
WRITE: /05(128) SY-ULINE.
E X C E L O P E R A T I O N
CLEAR: IT_EXCEL[],
WA_EXCEL.
PERFORM APPEND_BLANK_LINE USING 1.
WA_EXCEL-cell_02 = ' XYZ Ltd. '.
APPEND WA_EXCEL TO IT_EXCEL.
CLEAR: WA_EXCEL.
WA_EXCEL-cell_02 = 'Shift Asset Depreciation - Period/Year-wise Report.'.
APPEND WA_EXCEL TO IT_EXCEL.
PERFORM APPEND_BLANK_LINE USING 1.
ENDFORM. " DISPLAY_TOP_OF_PAGE
*& Form APPEND_BLANK_LINE
text
-->P_1 text
FORM APPEND_BLANK_LINE USING P_LINE TYPE I.
DO P_LINE TIMES.
CLEAR: WA_EXCEL.
APPEND WA_EXCEL TO IT_EXCEL.
enddo.
ENDFORM.
*& Form EXPORT_TO_EXCEL
text
--> p1 text
<-- p2 text
FORM EXPORT_TO_EXCEL .
DATA: L_FILE_NAME(60) TYPE C.
Create a file name
CONCATENATE 'C:\' 'Shift_Depn_' SY-DATUM6(2) '.' SY-DATUM4(2)
'.' SY-DATUM+0(4) INTO L_FILE_NAME.
Pass the internal table (it_excel which is already populated )
to the function module for excel download.
CALL FUNCTION 'WS_EXCEL'
exporting
filename = L_FILE_NAME
tables
data = IT_EXCEL
exceptions
unknown_error = 1
others = 2.
if sy-subrc <> 0.
message e001(ymm) with 'Error in exporting to Excel.'.
endif.
ENDFORM. " EXPORT_TO_EXCEL
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When you click the button - Export to Excel ( GUI-Status) you'll be able to export the content of the Internal Table to an Excel file .......
Regards,
Abir
Don't forget to award Points * -
How can change the font in the script output and the data grid ?
How can change the font in the script output and the data grid in Sql Developer?
You can't easily unless you have the latest version (2.1.1).
If you do have this version then changing the font in the Tools/Preferences menu under the code editor/fonts section will also change the font of the data grid.
For details of changing the fonts in an earlier version then see Sue's post below.
http://sueharper.blogspot.com/2010/03/back-to-basics-changing-font-setting-in.html
Maybe you are looking for
-
How to embed an OpenType font in Beta 2?
Hi Folks I'm trying to embed an OpenType font into a Flash Builder Beta 2 project and haven't been successful yet. What I've tried so far: 1. changing the order of the font managers in the flex-config.xml file, to put the one that handles OpenType fi
-
This question was posted in response to the following article: http://help.adobe.com/en_US/indesign/cs/using/WSa285fff53dea4f8617383751001ea8cb3f-6c43a.h tml
-
Photosmart C6280 not printing color/both sides with Mac
Hello HP Community, I have a Macbook Pro running iOS X 10.9.2 and a AIO Photosmart C6280. I am have downloaded the printing/scanning software and drivers. Everything installed without problem. I have also scanned with no problem. However, no matter w
-
Best way to update subclasses of UILabel and UIImageView?
Hello- I'm looking for some strategic suggestions before I dive into this. I have subclassed UILabel and UIImageView to get text and tint colors from a theme color stored in UserDefaults and it all works fine, but I'd like to reduce the code footprin
-
Freetext with more than 300 char show with function or class
Hi all I search a function or a Class how could show freetext with more than 300 char like a popup. Now somebody one ? Thanks in advance