How to save data in 4-bit mode instead of U8
Hi
I use LabVIEW to acquire and save data through the counter timer PCI6602.
My signals are really low so the data can be expressed in 4-bits (0-15).
I have used the conversion to U8 and write them using "Write Binary Files"
So this uses 1 byte for each data point but I would like to reduce it to 4bit (half byte) for each data point.
Can anyone help me with this?
I am attaching my program for reference
Solved!
Go to Solution.
Attachments:
DAQ-longvector1.vi 64 KB
Here's some easy code how to do it.
Note that this code assumes that the data is 4bit (0..15). If any of the upper 4 bit are set, you've got problems, of course
See if this makes sense. Good luck.
This example uses a single 1D array. You would eliminate the decimate/interleave and just use the two arrays.
A small comment to your code. There are a few weird constructs, but the use of two "split array" operations to take a simple derivative seems overkill. This made a honorary mention in the Rube Goldberg Hall of Fame.
Message Edited by altenbach on 12-04-2008 05:18 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
8bitTo4bit.png 18 KB
Similar Messages
-
How to save data in ztable after editing in alv report
how to save data in ztable after editing in alv report?
Hi,
Please find the attachment below.This may be usefull to you.
[http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29]
Regards,
Ramakrishna Yella. -
Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory
Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it.
Alex D
Applications Engineer
National Instruments -
How to save data model design in pdf or any format..?
how to save data model design in pdf or any format..?
i ve created design but not able to save it any mage or pdf formatFile -> Print Diagram -> To PDF File
-
How do i convert to 32-bit mode on the computer for a plugin
How do i convert to 32-bit mode for a plugin
For what application or do you mean altogether? For a single application select it. Press COMMAND-I to open the Get Info window. Check the box labeled "Open in 32-bit mode."
-
How generate a XML file & how to save data in that file?
hi,
How to generate an xml file & how to add data in that xml file? is there anyone who can help me about this? Firstly i need to open a xml file and after that i need to save user data in that file? how i will do it? What will be the solution of this? please give me solution........
with regards
BinaWith an API like Xerces you can parse an XML document into a DOM tree. You can do modifications on that tree manually and then write it back out as XML data.
http://xerces.apache.org/xerces2-j/ -
How to put itunes in 64 bit-mode??
I recently downloaded Mavericks and when I try to open itunes on my computer, it states that I have to run it in 64-bit mode. It gives me instructions on how to change my itunes from 32 to 64 bit-mode by going to itunes on Finder, clicking "get info" and unchecking 32 bit-mode, but once I got to the "get info" step, there wasn't an option anywhere to uncheck the 32 bit-mode box!
Is there another way I can update my itunes to 64 bit-mode?? I can't even open my itunes without this message popping up!Open About This Mac from the Apple Menu. Check that you really are running 10.9.1.
Drag iTunes to your Trash, then download and install again. The link is in the previous post. -
How to save data from a waveform chart to a file?
Hi! I have a question:how to save a real time data from a waveform chart? attachement is a example,how can i do to save the data from 0 second to 25 seconds to a file ?thanks!
Attachments:
example.vi 23 KBYou can use a property node to get the chart history as a array. Then you can write that data to the file. The data in the array in you example can also be writen to a file. If you only wnat a portion of the data to be saved, use the Array Subset function to get the part you want.
Lynn -
Offline Adobe Form using GP - How to save data to SAP
Hi,
I have the following requirement.
o An offline form is sent to different users and when they fill the form and Click on Submit, the data should be saved to SAP.
o When the data is submitted, it should be recognize the user and multiple clicks if any so that data is not duplicated
I have used Guided Procedures for this. I have created an Interactive Form callable object with an xdp template and "Create offline Interactive form and send by e-mail" option.
Problem:
1. The document emailed to user can be submitted only once. My requirement is whenever form is submitted it should update the previous data.
2. How to save this data to SAP?
Version:
SAP NW SP12
Adobe Live cycle designer 7.1
I have gone through various blogs on Adobe Offline interactive forms and GP but I could not get a solution for this. Please help.
Thank you,
VasuHi,
IMHO there is no easy solution for your requirement. However there is a workaround: you can create so-called "impersonalized" forms. They can be sent or returned as many times as needed from same or different users. However the effect will be that for each form sent out and accepted by GP, GP will start a new GP process. That means that the forms are the first step of such a process - so to say.
An offline form "in the middle" of a process can be embedded into the process as a dedicated step only. Once this form is returned to GP by the user, the process is continued and 2nd or later form returns are ignored. However there is the possibility to build an additional step into GP to check the input data and if they aren't valid to send out the form to the user once again.
So you see that there are some possibilities but no straight forward solution for your needs. Hope I could help anyhow.
Regards,
Jan -
Hi,
I wanted to save data acquired from NI-DAQ (for example, NI 9234) in a file using the DAQ-mx ANSI C Code. The response I got was as follows:-
One way to do it is with TDMS logging. DAQmx comes with functions designed to log to a TDMS file. This is a special file type that is used for collecting data in a logical format. It can be displayed in a TDMS viewer where data is separated into groups and channels. NI-DAQmx provides examples for how to log to TDMS. Look at the TDMS examples in the C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage directory.
However, now I want to know is there a way that using that same C code, can we save the data in a .txt file format (Text File) instead of a TDMS file? We actually want to access that file through MATLAB (that's why we want to save it in text format).
Also on an other note, is there a way we can access & open TDMS files by MATLAB?
Thanks,
Sauvik Das GuptaThere's a way you can access TDMS files in MATLAB:
http://zone.ni.com/devzone/cda/tut/p/id/7446 -
How to save data in columns with headers?
I'm trying to save 10 different types of data into individual columns with headers, but I can either get one giant column of data with the given header at the start of each data set (imbeded in the column) or I can get the headers in different columns, but the data all in one row. This seems like a simple problem, but for the life of me I can't figure it out--HELP!
I've attached my code...don't laugh, I think I've created a monster trying to figure this out. What I'm trying to get is one column with the header "Power (watts)" and then the power data in that column, one column with the header "angular acceleration (rad/s^2)" and then the angular acceleration data in that column, and so on...
Thanks!
Attachments:
RILE-25.vi 335 KBHi
Take a look at this VI / Block diagram pic
Here, I am demonstrating how to write data to a file column wise along with relevant column headers
Hope this helps
Regards
Dev
Attachments:
header_column data.JPG 49 KB
header_column data.vi 20 KB -
How to save data from form into database
i nid to save data from form into the new table, @abc.
got any idea ?
smtg like oObj = BaseAddOn.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes) this but it is a new object or user data source.
Thankshi
i have created UDO i have also done registration i want to bind item master completely to matrix and then in one column i will set check box to check unchecked and then i want to save it to database
i have one user defined form and 4 matrix and 4 child tables
for each matrix i have given 1 form and i have to transfer the data from temp form to main form matrix having large data in matrix on temp form to main form matrix
to load data on matrix i have used for loop that i want to avoid so how i can bind large data to matrix without for loop
regards
amey -
How to save data in a string control?
I want to save data in a string control or indicator. I know that I can rt-click and make the data default. But can it be done through a proberty node or something else when the program is running?
There isn't a "Make Current Value Default" method that you can invoke programmatically, this would require your VI to be saved when it was closed, which obviously couldn't be done if it had been built into an executable.
You could read the values from the controls/indicators and save them in a .ini file using the Configuration File VIs on the File I/O palette, and have some code at the start of your program that reads the values from the file and puts them into the objects using local variables. -
How to save data after clicking checkbox stored in databasetable
TYPE-pools: slis.
tables:mkpf,mseg,mard.
TYPES: BEGIN OF tp_data,
mblnr LIKE mseg-mblnr,
matnr LIKE mseg-matnr,
werks LIKE mard-werks,
lgort LIKE mard-lgort,
lgpbe LIKE mard-lgpbe,
charg LIKE mseg-charg,
bwart LIKE mseg-bwart,
budat LIKE mkpf-budat,
menge LIKE mseg-menge,
meins LIKE mseg-meins,
kostl LIKE mseg-kostl,
aufnr LIKE mseg-aufnr,
rsnum LIKE mseg-rsnum,
checkbox TYPE c,
__mark,
END OF tp_data,
tp_tbl_data TYPE STANDARD TABLE OF tp_data.
Constants
Data objects (variable declarations and definitions)
Report data to be shown.
DATA: it_data TYPE STANDARD TABLE OF tp_data.
Heading of the report.
DATA: t_heading TYPE slis_t_listheader.
========================== Selection Screen ==========================
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:smblnr FOR mseg-mblnr MODIF ID m1,
smatnr FOR mseg-matnr MODIF ID m2,
swerks FOR mard-werks MODIF ID m3,
slgort FOR mard-lgort MODIF ID m4,
slgpbe FOR mard-lgpbe MODIF ID m5,
scharg FOR mseg-charg MODIF ID m6,
sbwart FOR mseg-bwart MODIF ID m7,
skostl FOR mseg-kostl MODIF ID m8,
saufnr FOR mseg-aufnr MODIF ID m9,
srsnum FOR mseg-rsnum MODIF ID m10.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS:pre RADIOBUTTON GROUP radi USER-COMMAND ucomm DEFAULT 'X',
pse RADIOBUTTON GROUP radi,
bps RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETER:layout TYPE i.
SELECTION-SCREEN END OF BLOCK b3.
=========================== Event Blocks =============================
AT selection-SCREEN.
start-OF-selection.
PERFORM get_data USING it_data.
END-OF-selection.
PERFORM build_alv USING it_data t_heading.
=========================== Subroutines ==============================
*& Form get_data
Gets the information to be shown in the report.
FORM get_data USING t_data TYPE tp_tbl_data.
SELECT msegmblnr msegmatnr mardwerks mardlgort mardlgpbe msegcharg msegbwart mkpfbudat
msegmenge msegmeins msegkostl msegaufnr mseg~rsnum
INTO CORRESPONDING FIELDS OF TABLE t_data
FROM mseg
JOIN mard ON mardmatnr EQ msegmatnr
JOIN mkpf ON msegmblnr EQ mkpfmblnr
WHERE mseg~matnr IN smatnr.
ENDFORM. " get_data
*& Form build_alv
Builds and display the ALV Grid.
FORM build_alv USING t_data TYPE tp_tbl_data
t_heading TYPE slis_t_listheader.
ALV required data objects.
DATA: w_title TYPE lvc_title,
w_comm TYPE slis_formname,
w_status TYPE slis_formname,
x_layout TYPE slis_layout_alv,
t_event TYPE slis_t_event,
t_fieldcat TYPE slis_t_fieldcat_alv,
t_sort TYPE slis_t_sortinfo_alv.
REFRESH t_fieldcat.
REFRESH t_event.
REFRESH t_sort.
CLEAR x_layout.
CLEAR w_title.
Field Catalog
PERFORM set_fieldcat2 USING:
1 'MBLNR' 'MBLNR' 'MSEG' space space space space space space space space space space space space t_fieldcat ,
2 'MATNR' 'MATNR' 'MSEG' space space space space space space space space space space space space t_fieldcat ,
3 'WERKS' 'WERKS' 'MARD' space space space space space space space space space space space space t_fieldcat,
4 'LGORT' 'LGORT' 'MARD' space space space space space space space space space space space space t_fieldcat ,
5 'LGPBE' 'LGPBE' 'MARD' space space space space space space space space space space space space t_fieldcat ,
6 'CHARG' 'CHARG' 'MSEG' space space space space space space space space space space space space t_fieldcat ,
7 'BWART' 'BWART' 'MSEG' space space space space space space space space space space space space t_fieldcat,
8 'BUDAT' 'BUDAT' 'MKPF' space space space space space space space space space space space space t_fieldcat,
9 'MENGE' 'MENGE' 'MSEG' space space space space space space space space space space space space t_fieldcat,
10 'MEINS' 'MEINS' 'MSEG' space space space space space space space space space space space space t_fieldcat,
11 'KOSTL' 'KOSTL' 'MSEG' space space space space space space space space space space space space t_fieldcat,
12 'AUFNR' 'AUFNR' 'MSEG' space space space space space space space space space space space space t_fieldcat,
13 'RSNUM' 'RSNUM' 'MSEG' space space space space space space space space space space space space t_fieldcat,
14 '__MARK' 'XFELD' space space space 'Select' 'Select this row' 'Sel' 'Select this row' space space space 'X' 'X' space t_fieldcat.
Layout
x_layout-zebra = 'X'.
Top of page heading
PERFORM set_top_page_heading USING t_heading t_event.
Events
PERFORM set_events USING t_event.
GUI Status
w_status = ''.
User commands
w_comm = 'USER_COMMAND'.
Order
Example
PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
PERFORM set_order USING 'LIFNR' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELN' 'IT_DATA' 'X' space 'X' t_sort.
PERFORM set_order USING 'EBELP' 'IT_DATA' 'X' space space t_sort.
Displays the ALV grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = t_fieldcat
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
TABLES
t_outtab = t_data
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.
ENDFORM. " build_alv.
*& Form set_top_page_heading
Creates the report headings.
FORM set_top_page_heading USING t_heading TYPE slis_t_listheader
t_events TYPE slis_t_event.
DATA: x_heading TYPE slis_listheader,
x_event TYPE LINE OF slis_t_event.
Report title
CLEAR t_heading[].
CLEAR x_heading.
x_heading-typ = 'H'.
x_heading-info = 'Reporte Prueba'(001).
APPEND x_heading TO t_heading.
Program name
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Program: '.
x_heading-info = sy-repid.
APPEND x_heading TO t_heading.
User who is running the report
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'User: '.
x_heading-info = sy-uname.
APPEND x_heading TO t_heading.
Date of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Date: '.
WRITE sy-datum TO x_heading-info.
APPEND x_heading TO t_heading.
Time of execution
CLEAR x_heading.
x_heading-typ = 'S'.
x_heading-KEY = 'Time: '.
WRITE sy-uzeit TO x_heading-info.
APPEND x_heading TO t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-FORM = 'TOP_OF_PAGE'.
APPEND x_event TO t_events.
ENDFORM.
*& Form set_events
Sets the events for ALV.
The TOP_OF_PAGE event is alredy being registered in
the set_top_page_heading subroutine.
FORM set_events USING t_events TYPE slis_t_event.
DATA: x_event TYPE LINE OF slis_t_event.
Example
clear x_event.
x_event-name = .
x_event-form = .
append x_event to t_event.
ENDFORM.
*& Form set_order
Adds an entry to the order table.
FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
t_sort TYPE slis_t_sortinfo_alv.
DATA: x_sort TYPE slis_sortinfo_alv.
CLEAR x_sort.
x_sort-fieldname = p_fieldname.
x_sort-tabname = p_tabname.
x_sort-UP = p_up.
x_sort-down = p_down.
x_sort-subtot = p_subtot.
APPEND x_sort TO t_sort.
ENDFORM. "set_order
*& Form set_fieldcat2
Adds an entry to the field catalog.
FORM set_fieldcat2 USING p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
t_fieldcat TYPE slis_t_fieldcat_alv.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-HOTSPOT = p_hotspot.
wa_fieldcat-CHECKBOX = p_checkbox.
wa_fieldcat-ICON = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
Set reference fieldname, tablenam and rollname.
If p_ref_tabname is not given, the ref_fieldname given is a data element.
If p_ref_tabname is given, the ref_fieldname given is a field of a table. In case ref_fieldname is not given, it is copied from the fieldname.
IF p_ref_tabname IS INITIAL.
wa_fieldcat-rollname = p_ref_fieldname.
ELSE.
wa_fieldcat-ref_tabname = p_ref_tabname.
IF p_ref_fieldname EQ space.
wa_fieldcat-ref_fieldname = wa_fieldcat-fieldname.
ELSE.
wa_fieldcat-ref_fieldname = p_ref_fieldname.
ENDIF.
ENDIF.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
Set as editable or not.
IF p_edit IS NOT INITIAL.
wa_fieldcat-INPUT = 'X'.
wa_fieldcat-EDIT = 'X'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
=========================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'XXXXX'
it_list_commentary = t_heading.
ENDFORM. " alv_top_of_page
*& Form user_command
Called on user_command ALV event.
Executes custom commands.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Example Code
Executes a command considering the sy-ucomm.
CASE r_ucomm.
WHEN '&IC1'.
Set your "double click action" response here.
Example code: Create and display a status message.
DATA: w_msg TYPE string,
w_row(4) TYPE n.
w_row = rs_selfield-tabindex.
CONCATENATE 'You have clicked row' w_row
'field' rs_s lfield-fieldname
'with value' rs_selfield-value
INTO w_msg SEPARATED BY space.
MESSAGE w_msg TYPE 'S'.
ENDCASE.
End of example code.
ENDFORM. "user_command
this is mycode,mblnr, matnr and checkbox both field had created in database table
then save data after clicking checkbox data stored in database table,and next clickin checkboxes are no change. this my requirment.
plz send me code .Try this
In user_command form...
LOOP AT IT_DATA.
IF CHECKBOX __MARK EQ 'X'.
write logic wht u want....
ENDIF.
ENDLOOP. -
How to save data to access database in dreamweaver
Hello,
I want to save data from webpage to MS access database. I am
using dreamweaver MX 2004 developing tool. For server side
scripting I am using asp page but I am not geting any result. And I
am calling this asp page using HTML codes (using "action").
Please anybody suggest me proper way for this.Thanks for the reply....I'will try your suggestion
........But still I will appriciate if you can check my codes......
I am using following codes for webpages,
<form name="form1" action="add_to_database.asp"
method="post">
<div align="center">
<table width="80%" border="0">
<td><b>FEEDBACK FORM</b></td>
<tr> <td>Name :</td>
<td><input type="text" name="uname"></td>
</tr>
<tr>
<td>Email :</td>
<td> <input type="text" name="email"></td>
</tr>
<tr>
<td>Comments :</td>
<td><textarea
name="comments"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Submit details"
name="submit" onClick="validate()" ></td>
</tr>
</table>
</div>
</form>
and using the action and post method I am calling following
asp page
<body>
<%
Dim uname, email, comments
Dim Conn
Dim Rs
Dim sql
uname = Request.Form("uname")
email = Request.Form("email")
comments =Request.Form("comments")
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=" & Server.MapPath("users.accdb")
sql= "INSERT into adduser(uName, Email, Comments) values(' "
& uname & "', '" & email & "', '" & comments
Conn.execute sql
Rs.Open sql, Conn
Rs.AddNew
Rs.Fields("Name") = Request.Form("name")
Rs.Fields("Email")=Request.Form("email")
Rs.Fields("Comments") = Request.Form("comments")
Rs.Update
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
%>
</body>
Thanks,
Maybe you are looking for
-
HI, I have two open items for a particular vendor (one down payment and one invoice) for the same amount. when I am trying to clear down payment against the invoice IN F-54 I am I am getting the error saying "No down payment exist". I have checked th
-
Hi , I need to insert a row in ALV output. On click of a Inser Row button a pop up should show with a parameter.Once the value in entered in the parameter enter is hit , the first column of the new row should have value put in that parameter as non e
-
Can XML Publisher create a report that contains an image that is retrieved from the database in an intermedia type column, or must the image reside on the hard drive?
-
Project Online report templates
Hi I, being a novice, have managed to mess up all the out of box reports that come with Project Online. Is there anyway that I can have these reports reinstated to a pre-messed up state. I promise not to edit the templates again. Thanks Alex
-
OnLoad event on Body tag locked by template
I have a behavior that needs to be called with an OnLoad event. The page I need it on is attached to a template, so the Body tag is not available for editing. What are my options? Thanks!