Python DAQmxReadCounterScalarU32 error-200230
Hi all
I use Python 3.2 and NOR-6521 Council.
I try to count the number of rising of my signal edges when I click on a start button, but I still have the code of error-200230.
My program is the following:
#Variables
DAQmx_Val_Rising = int32 (10280)
InitialCount = uInt32 (0)
DAQmx_Val_CountUp = int32 (10128)
Timeout = float64 (10)
NULL = types. POINTER (ctypes.c_int))
value = uInt32)
#Source channel
chan_count = ctypes.create_string_buffer (b' 1/ctr0 ')
#Create a task
TaskHandle = uInt32
TaskCount = TaskHandle (0)
NIDAQ. DAQmxCreateTask ("", ctypes.byref (TaskCount))
#Create a counter entry
NIDAQ. DAQmxCreateCICountEdgesChan(TaskCount,chan_count,"",DAQmx_Val_Rising,InitialCount,DAQmx_Val_CountUp)
#Start task
NIDAQ. DAQmxStartTask (TaskCount)
#Read the number of meet the edges when click the GUI
NIDAQ. DAQmxReadCounterScalarU32(TaskCount,timeout,value,null)
I think my mistake is in the declaration of value, but I don't understand why.
Does anyone have an answer? It is very urgent.
Thank you
After several tries, I found the solution
#Read the number of meet the edges when click the GUI
NIDAQ. DAQmxReadCounterScalarU32 (TaskCount, timeout, types. POINT (ctypes.c_uint32), (value), null)
Tags: NI Hardware
Similar Questions
-
Hey,.
I need help for Python 3.1.1 installed on my computer. Whenever I try to install it, an error pop up to say that ' the Administraton of system has set policies to prevent this installation. I am the administrator. I think I found the place for display in administrative tools: "Local security policy", I just need to know what secondary section and the policy, I need to change in order to install it.
Any help would be appreciated.
Thank you.It comes with Vista, upgrade install and activate Forum.
http://social.answers.Microsoft.com/forums/en-us/vistaprograms/threads
They will help you with your question in Forum Vista programs at the above address.
See you soon.
Mick Murphy - Microsoft partner
-
Strange timing errors, python process taking CPU
I have 5 Server freshly moved on top of Yosemite.
I migrated Server 3 to 4 and now 5. My sites all done. My e-mail service is very good.
I've never used the calendar service, and used to spam my system with Dingo errors log in Server 4. I thought it would be fine in the Server 5 because 5 fixed issues for many in the nets here.
Not for me. So I tried to turn it on. I get this error in the calendar error log:
2016-02-14 22:45:25-0600 [---] (port UNIX ' / var/run/caldavd/caldavd.sock' closed)
2016-02-14 22:46:20-0600 [---] open journal.
2016-02-14 22:46:20-0600 [---] ControlSocket go from ' / var/run/caldavd/caldavd.sock'
2016-02-14 22:46:22-0600 [-] [txdav.base.datastore.subpostgres #error] unable to connect to database schema creation: Broken pipe [Errno [32]
2016-02-14 22:46:23-0600 [-] [txdav.base.datastore.subpostgres #critical] cannot start or connect to the postgres: md5 password authentication failed
2016-02-14 22:46:23-0600 [---] (port UNIX ' / var/run/caldavd/caldavd.sock' closed)
Is it possible that I can delete calendar and let app Server make it fresh? I will lose no data because I've never used.
During this time, my server otherwise happy is stuck using 9% CPU for several treatments Python and postgres continue taking up 100% CPU when I look up there. How can I go back factory calendar?
The caldavd_setup.log is trivial and seems that everything worked until the end.
14 February 19:53:50 [CalendarServerCommonSetup] successful Serveradmin
14 February 19:53:50 [CalendarServerCommonSetup] call fix-permissions
14 February 19:53:50 [CalendarServerCommonSetup] calling calendarserver_upgrade - postprocess
14 February 19:54:01 [CalendarServerCommonSetup] out of calendarserver_upgrade: 2016-02-14 19:53:53-0600 Converting augments.xml
2016-02-14 19:53:53-0600 root ACL:
2016-02-14 19:53:53-0600 Nav ACL:
Created the directory: / var/run/caldavd_requests
2016-02-14 19:53:58-0600 cannot connect to database schema creation: Broken pipe [Errno [32]
2016-02-14 19:53:59-0600 may not start or connect to the postgres: md5 password authentication failed
Failed to start the service.
14 February 19:54:01 [CalendarServerCommonSetup] send to serveradmin: calendar: command = exportPushCertificates
14 February 19:54:01 [CalendarServerCommonSetup] output: calendar: exported = 'Yes '.
14 February 19:54:01 [CalendarServerCommonSetup] performance: /Applications/Server.app/Contents/ServerRoot/usr/sbin/serverctl enable service = org.calendarserver.agent
14 February 19:54:01 [CalendarServerCommonSetup] output: {}
}
14 February 19:54:01 [CalendarServerCommonSetup] performance: /Applications/Server.app/Contents/ServerRoot/usr/sbin/serverctl enable service = org.calendarserver.relocate
14 February 19:54:02 [CalendarServerCommonSetup] output: {}
}
14 February 19:54:02 [CalendarServerCommonSetup] performance: /Applications/Server.app/Contents/ServerRoot/usr/sbin/serverctl enable service = org.calendarserver.archive
14 February 19:54:02 [CalendarServerCommonSetup] output: {}
}
14 February 19:54:02 [CalendarServerCommonSetup] run: / bin/launchctl start org.calendarserver.agent
14 February 19:54:02 [CalendarServerCommonSetup] performance: /Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/Setup/Calen darServerLogRotationConf
14 February 19:54:02 [CalendarServerCommonSetup] Service has not been activated previously
14 February 19:54:02 [CalendarServerCommonSetup] out successfully
-
Python, call DLLs in LabVIEW: Fatal internal error when accessing output String Cluster
Hello
We have compiled a DLL in LabVIEW (TestError.dll) and tried to call it from Python.
TestError.dll includes 2 functions:
1 testErreur: cluster 1 entry string, 1 channel indicator
2 TestError2: 1 channel input, 1 bunch of output string
What we try to do in Python is actually something like this:
1 provide values to controls in the functions of the DLL.
2. call the DLL.
3 get the values of the indicators.
What we have seen are:
1 read/write operations on normal data types (string, digital) indicators/controls are OK
2. write operation on the Cluster string entry is OK
3. read operation on the Cluster output string is not OK. The following error is still prompted for:
«Unrecoverable internal error: 'MemoryManager.cpp', line 437.» LabVIEW version 8.6... »
Also joined the TestError.prj and python code.
Grateful if someone can help to explain why we get this error and how to overcome?
Thank you
howmean
What we have seen are:
1 read/write operations on normal data types (string, digital) indicators/controls are OK
2. write operation on the Cluster string entry is OK
3. read operation on the Cluster output string is not OK. The following error is still prompted for:
«Unrecoverable internal error: 'MemoryManager.cpp', line 437.» LabVIEW version 8.6... »
Also joined the TestError.prj and python code.
It is very logical that it does not, and the bad news is, it cannot really be implemented reliable of a process not LabVIEW.
LabVIEW channels (and tables) are very specific species. They are then called handles, which are pointers to a pointer to a block of memory. If you have a control or indicator on its own, the Prototype configuration allows you to configure this setting as a C. LabVIEW data pointer, when creating the DLL, create heels C for each exported function and place the code to do the translation between the past C pointer to and necessary LabVIEW data handle. For strings and arrays within the cluster, there is no configuration option and the DLL is expected to pass a structure with data handles native LabVIEW in there.
You may say that creating handles data in your calling process enough to trick LabVIEW. For the input variables that actually CAN sometimes work (but is a delicate and dangerous generally to handle this). There is no way to make it work for output variables. LabVIEW will try to resize handle to fill data in that he wants to make. This resizing is done using internal memory manager of LabVIEW. This will work only if it had been allocated by EXACTLY the same instance of the memory manager. Otherwise, it refers to a different memory segment and catastophally fail. The only way to make this work perhaps, with luck, taking your heart and prayer to the gods, is to lvrt.dll to allocate a handle that you must pass to the DLL. Still find the good lvrt.dll, which will execute your DLL LabVIEW is a major challenge.
-
Error "ImportError: no module named tkinter" Programming Python
Hello
I'm writing a Python program. This program is supposed to do a bar with two buttons on it pop up.
However, I can't get this to work. The error is: "ImportError: no module named tkinter".
Here's the script of my program.
If someone knows enough about Python to know what I'm doing wrong, help would be greatly appreciated!
Thank you!
from tkinter import *.
class Application (Frame):
def say_Yeh (self):
Print ("Yeh! Your right button does something! »)def createWidgets (self):
cottages. QUITBUTTON = Button (self)
cottages. QUITBUTTON ['text'] = "QUIT BUTTON"
cottages. QUITBUTTON ["fg"] = "red".
cottages. QUITBUTTON ['order'] = self.quit
cottages. QUITBUTTON.pack ({"side": "left"})Self.do_something = Button (self)
Self.do_something ["text"] = 'CLICK TO DO SOMETHING BUTTON',
Self.do_something ["Command"] = self.say_Yeh
Self.do_something. Pack ({"side": "left"})def _init_ (self, master = None):
Frame._init_ (self, master)
Self.Pack)
self.createWidgets)root = Tk()
App = Application (master = root)
App.mainloop)
root. Destroy()Sorry, I thought about it!
-
error code and string exchanged in python application
Hello.
1. I am writing the python program that uses 2.4.16 last dbxml. It seems that it is small bug there. I'm capture the blocking error when you try to manage the blockages. And when I catch him, I don't have the error string and the error code exchanged. Example of code might look like this:
def some_function (self):
Bq. # & lt; some preparations here & gt; ------While retry and max_tries & gt; 0:BQ. Try: bq. If self._transaction:bq. result = expr.execute (self._transaction, self._context)
Another thing:
Bq. result = expr.execute (self._context)
Self._RESULT = result.__iter__)
Self._executed = True
Retry = False
the XmlException exception, inst:
Bq. print inst.what # does not print the string, but the code here ("-30095")-inst.getDbErrno (print) # not print the code, but the chain here ("" Error: DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock ' ")------# so with this bug I have to write the following code:------if inst.what == DB_LOCK_DEADLOCK:bq. max_tries-= 1------retry = True
Bq. If self._transaction:bq. Self._transaction. Abort()
Another thing:
Bq. raise DatabaseError (inst.getDbErrno)
2. actually, I managed a blockage in a very simple way. I just launch 2 proceccess, insert the new node at the end of the same node in the same container. Blockages appear just after the second process is executed. How does such a thing happen? Simple simultaneous writing should we not resolved with locking and blocking of the system? The second process to wait for the first transaction finsh, shouldn't it?
3. I have a question about contexts. I can create two types of contexts - XmlQueryContext and XmlUpdateContext. Which of them should I use when I do a query that updates/inserts/replaces only some nodes in the document without having to work with the entire document with i.e. function updateDocument? The lock type is type of context or it is decided later after analysis of the query?
Hello
1. the XmlDatabaseException seems to have a constructor with arguments in the wrong order:
def __init__ (self, dberr, msg):
should be
def __init__ (self, msg, dberr):
In dbxml.py in the XmlDatabaseError constructor. Make sure that change and I would like to know how it works.2. it depends on how you insert. If you insert a query which, apparently, you can do it is likely that the query part is what's blocking with the update. Calls simultaneous putDocument() in 2.4.16 will tend to back up on another. No matter, if you make simultaneous anything, you must manage the blocking. There will be less because the container expands.
3 contexts - use the one that calls the API. Querys, put to date or not, call for XmlQueryContext. Direct update (except Java) operations call for XmlUpdateContext. It can be made optional in Python in the future, but for now, it isn't.
Kind regards
George
-
MacBook Pro error - Dock reopen
My Macbook Pro recently had a problem when opening, so I decided to restart it. After a long recharge, I saw that the dock was not reload and a message titled "executable stub py2app has encountered a fatal error and will end now" appeared.
The text says: "the Info.plist file must have a range of PyRuntimeLocations containing the string values for favorite Python runtime locations. These channels should be mach type ID of "tool" - L "@executable_stub" and "~" prefixes will result accordingly. »
What can I do to solve this problem QUICKLY now?
Credit: BDAqua
Try the safe boot mode.
https://discussions.Apple.com/thread/5308171?TSTART=0
Google, Dropbox or CleanMyMac reader?
Here is the result of a Google search.
Mac py2app stub executable has encountered a fatal error and will end now"
-
Get sync 1.1 installation error
I try to install sync 1.1 according to the instructions in the https://docs.services.mozilla.com/howtos/run-sync.html#howto-run-sync11
System Ubuntu LTS 14.04
After you download the source and try to build it has reported a number of ssl errors. Online advice, I installed a few python packages that made the error to go away. (Wiping the local directory and restart after each error).
Now, it gives me an error related to SQLAlchemy. It's even after a succesfull apt - get install python-sqlalchemy it seems to want a local version.
The output to build:
(snip)
Prescription already up-to-date: docopt a./lib/python2.7/site-packages/docopt-0.6.2-py2.7.egg (from m
etlog-py > = 0.9.6-> r dev - reqs.txt (line 20))
Installation of packages collected: WebOb, WebTest, beaker, python-Memcache, SQLAlchemy, Zope.interface, r
epoze.who, zope.deprecation, metlog-cef scrypt
Found existing installation: WebOb 1.4.1
Uninstalling WebOb - 1.4.1:
1.4.1 - WebOb uninstalled successfully
Running setup.py install for WebOb
Found existing installation: WebTest 2.0.18
Uninstalling WebTest - 2.0.18:
Uninstalled successfully WebTest - 2.0.18
Running setup.py install for WebTest
Running setup.py install for beaker
Found existing installation: SQLAlchemy 1.0.8
Uninstalling SQLAlchemy - 1.0.8:
SQLAlchemy - 1.0.8 uninstalled successfully
Running setup.py install for SQLAlchemy
Running setup.py install for Zope.interface
Running setup.py install for repoze.who
Running setup.py install for zope.deprecation
Running setup.py install for metlog-cef
Running setup.py install for scrypt
Beaker, SQLAlchemy WebOb WebTest metlog-cef python-Memcache repoze.who scrypt zope.deprecation Zope.interface successfully installed
/Home/.../Server-full/local/lib/python2.7/site-packages/PIP/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: a true SSLContext object is not available. This prevents the urllib3 of appropriately SSL configuration and cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latestsecurity.html#insecureplatformwarning.
InsecurePlatformWarning
Traceback (most recent call changed):
(snip)
OSError: [Errno 2] No. file or directory: ' / home/.../server-full/local/lib/python2.7/site-packages/SQLAlchemy-1.0.8-py2.7-linux-x86_64.egg '.The file does not exist, as indicated, however, SQLAlchemy - 0.7.10 - py2.7.egg - info exists in that directory, as does a subdirectory named sqlalchemy.
Did I miss a step or a version?
I'm not the expert here hosting on your own server to sync, but because 1.1. has been put into production a new matching device will be really hard.
"Stuff JPAKE will be broken."I could start checking on 1.5-> https://docs.services.mozilla.com/sto.../apis-1.5.html#server-syncstorage-api-15
And ask your question in the sync distribution list: [[email protected]]
-
I'm trying to access an online simulation via MyMIS Lab of Pearson for a class online. I was using this simulation a couple of days, but when I logged on this morning, the simulation does not open. I copy and paste the error message that appears when I try to open it. Basically, it reads "you see this error because you have DEBUG = True in your file settings to Django. Change False and Django will display a 500 standard page. I have no idea what Django settings are and have studied how to change the setting, but I'm not familiar with this at all. Any help would be greatly appreciated so I can get my homework done! Thank you!!!
AttributeError at /simLaunch/launch/ 'Settings' object has no attribute 'XLSIMS_LAUNCH_URL' Request Method: POST Request URL: http://econdip.pearsoncmg.com/xlsim/simLaunch/launch/ Django Version: 1.5.2 Exception Type: AttributeError Exception Value: 'Settings' object has no attribute 'XLSIMS_LAUNCH_URL' Exception Location: /vh/docroots/econdip.pearsoncmg.com/prod/virtualenv/lib/python2.6/site-packages/django/conf/__init__.py in __getattr__, line 54 Python Executable: /usr/bin/python Python Version: 2.6.6 Python Path: ['/vh/docroots/econdip.pearsoncmg.com/prod/virtualenv/lib/python2.6/site-packages', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib64/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', '/vh/docroots/econdip.pearsoncmg.com/prod/server/glservice'] Server time: Sat, 30 Aug 2014 14:59:46 -0500 Environment: Request Method: POST Request URL: http://econdip.pearsoncmg.com/xlsim/simLaunch/launch/ Django Version: 1.5.2 Python Version: 2.6.6 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'gldata', 'econ.ca', 'econ.ue', 'gllaunch', 'datacapture', 'xlsims') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "/vh/docroots/econdip.pearsoncmg.com/prod/virtualenv/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response 115. response = callback(request, *callback_args, **callback_kwargs) File "/vh/docroots/econdip.pearsoncmg.com/prod/virtualenv/lib/python2.6/site-packages/django/views/decorators/csrf.py" in wrapped_view 77. return view_func(*args, **kwargs) File "/vh/docroots/econdip.pearsoncmg.com/prod/server/glservice/xlsims/views.py" in launchSim 23. if TPIUtils.has_valid_signature(launch_data, url=settings.XLSIMS_LAUNCH_URL, key='bphsc2014'): File "/vh/docroots/econdip.pearsoncmg.com/prod/virtualenv/lib/python2.6/site-packages/django/conf/__init__.py" in __getattr__ 54. return getattr(self._wrapped, name)
It's a problem with a Python script that runs on the server.
The site Web needs to solve this problem.
If the problem persists then contact them by e-mail.You can try to clear the cache and delete cookies from this Web site.
"Clear the Cache":
- Firefox > Preferences > advanced > network > content caching Web: 'clear now '.
'Delete Cookies' sites causing problems:
- Firefox > Preferences > privacy > "Use the custom settings for history" > Cookies: "show the Cookies".
-
Use applescript for Python Shell command
Is there a way where I can make applescript to view the output of the python script and also accepts input so that it can pass it to the python script? My script contains several entry so is it possible possible to do? For more than once in entry and exit every time?
You can certainly create handlers AppleScript (functions) that use Python HERE documents, with AppleScript variable passed into Python as command-line arguments, or returned to AppleScript. AppleScript's display of limited capacity, but does not preclude a cocoa of coding, or TCL GUI for the display format most of in the Python code.
You can also write a Python application that can invoke AppleScript, pass the values on the command line values and return to Python AppleScript. This can be done through a presentation of subprocess or directly through NSAppleScript.
Here's an AppleScript that uses a Python Manager to glance in a .docx Word document and display the names of fonts used in it. Only .docx, not. doc. Notes to escape the double quotes and back-slash in the Python script to appease AppleScript.
-wordfonts.applescript
-display fonts (read-only) in the Word (.docx only) document in the menu drop-down
-VikingOSX, 01/2016, support Apple community
-Version 1.2, the additional list comprehension to Python print statement, other settings.
property docx: {'org.openxmlformats.wordprocessingml.document'}
property mydefault: ((path to the documents folder) as text) as alias
Try
the value docxfile to POSIX path of (Choose file type docx default location mydefault without invisible)
If result = {return button: 'Cancel'} then error -128 - cancelled by the user
say application 'System events' to the value docxname to the name of (POSIX file docxfile as alias)
display the dialog box "Document:"& docxfile & return & return & (elements of my docxfonts (quoted form of docxfile)) as text with the title "Word Document Fonts" give up after 20.
we errnbr error error message number
Error_Handler (errnbr, errmsg)
end try
return
on docxfonts (thefile)
return the shell script "python".
import the zip file
import re
Import os
import sys
fonts =]
thedocx = os.path.expanduser(sys.argv[1])
If not thedocx.endswith ('.docx'):
raise exception ("not a valid docx Word document'")
If zipfile.is_zipfile (thedocx):
with the zip file. Zip (thedocx, 'r') as docxzip file:
XMLDATA = docxzip.read('word/fontTable.xml')
fonts = re.findall (r'(?<=w:name=)\"([ \\w+]+)\"="">', xmldata))
print (------"} \".format ('\\n'.comes ([x for x in sorted (fonts) if fonts])) ")
EXPRESSIONS OF FOLKLORE. "
end docxfonts
on error_handler (nbr, msg)
return Display alert «["& nbr &" "']" & msg as critical leave after 10 "»
end error_handler
Python script that illustrates the passage of an argument to an AppleScript application that runs as a subprocess.
=w:name=)\"([>#! / usr/bin/env python
# coding: utf-8
# dx.py: illustrates the passage of a Python variable in a function that
# contains a string variable (ascript) which is the AppleScript
# code that osascript runs in the sub-process. The value of allow
# following the scriptname as ARGV 1, which is taken by the
# argv clause of AppleScript.
# Use:. DX.py
# VikingOSX, 12/2015, Apple Support communities
# v1.2
import of subprocesses
Import atexit
import sys
MSG = 'the value of x is 10'.
procs =]
def send_dialog (allow):
AScript = "'
on run argv
Set userCanceled false
If (argv County) = 0 then
Tell application "system events" to display dialog ¬ "argv is 0". "
After 10
on the other
the value of msg (item 1 of argv) text
end if
Try
Tell application "system events" to display dialog ¬ msg
with the title 'Application Communication' give up after 10
the error number - 128
userCanceled set to true
try to end
If userCanceled then return "Cancel".
return
end of race
'''
Try:
proc = subprocess.check_output (['osascript', '-e', ascript, allow])
If "Cancel" in proc.decode('utf-8'): # the user presses the Cancel button
sys. Exit ("User Canceled")
except subprocess. CalledProcessError as e:
print (' Python error: [% d]\n%s\n' % e.returncode, e.output])
generator of # @atexit.register to clean any stray sub-process
def kill_subprocesses():
for proc in procs:
proc. Kill()
def main():
send_dialog (MSG)
If __name__ == "__main__":
sys. Exit (hand ())
-
Find the source of the massive compilation errors
Hi all
I am trying to determine the source of the errors on a generation of RT and therefore a massive to remove compilation live broken and unused running the project is important enough, so the output from compilation of mass is large. One thing I am struggling with trying to determine * why * an error. For example, I get a few CompileFile: error 7, which indicates that something is looking for a file that does not exist. How can I determine which leader is the search for the missing file? I've attached the output from the massive compilation, but also a python file that I use to interpret the files to find errors.
On another note about this file - what I'm doing with the release of Bad VI/Subvi? It almost seems as if he is allowed to disregard this output.
Any help is welcome. At soon cirrus
(okay, that I'm lame but you are not allowed to attach python so here is the script below)
FName = "mass_compile_log_10202016.txt."
with open (fname) as f:
line = f.readline () .strip)
I = 0 # track the error number
j = 0 # track the line number
# Only goes to find the first 30 records
<>
s = line [0:3]
j += 1# Not interested in a failure to load, search or bad messages VI...
otherwise (s == ' # ' or s == 'ISP' or s == 'Sea' or s == "(C:"):
I += 1 # increment the error
Print (STR (i) + "[" + str (j) + ' "].") + line)
line = f.readline () .strip)
f.Close)Thank you, udka.
In fact, I came across the easy solution (although there is always only one instance dangling out there that I can't explain). Simply
- Create a new project
- Add a snapshot of the file you want to compile mass
If you lack the screws in the massive compilation, these will appear in the missing build dependencies and you can know who is dependent on them.
About the wrong screw - it is difficult to know if this could be due to the fact that the compilation of mass occurs on local and he can't find the RT del VI (since it is not on the RT system). Whatever it is, I'm building again to see if I have an exe works on the RT system (the reason why I was making the massive compilation has been a failure on the exe - not when you build, but when running). I have attached my log of recent massive compilation for the comparison of what I started with.
-
Is there anyone who tries to use the iron with VeriStand Python scripting language?
My problem is that VeriStand has not its own interpreter and I have not found a way to run scripts.
Thank you all
Parameters cannot be defined with the function of channel values. They must be defined with the game or load the file called in the Manager of model class:
I don't remember exactly why, but I think that there are additional logic in the back-end of NI VeriStand to manage all the settings of update values at the same time if you use these calls. This way if you want to set a bunch of parameters, they all applied at the same time. Can't say the same for channel value calls.
#2 (that you listed) is the way to go. The error you are getting is "node does not exist", and the path you have in the CAL is not matching something that NI VeriStand acknowledges. You can use the GetParametersList call to ensure that your way is right.
-
RFmx and FetchSpectrum using Python
Hello
I'm trying to use RFmx through Python.NET. The code works until I have try to catch the spectrum using FetchSpectrum():
# create the name of the variable before you pass it to the method .NET
spectrum = RFmxSpecAnMXSpectrum# This does not work!
specAn.Spectrum.Results.FetchSpectrum (", timeout, spectrum)Here's the complete code:
import clr
import sys# location of the assemblies
assy_path = r'C:\Program files (x 86) \National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current'
sys. Path.Append (assy_path)CLR. AddReference ("NationalInstruments.RFmx.SpecAnMX.Fx40")
CLR. AddReference ("NationalInstruments.RFmx.InstrMX.Fx40")from NationalInstruments import *.
from NationalInstruments.RFmx.InstrMX import *.
from NationalInstruments.RFmx.SpecAnMX import *.# The VSA settings
resourceName = "5606_slave."
centerFrequency = 10.0e9 # Hz
referenceLevel = - 10 # dBm
externalAttenuation = 0.00 # dB
Timeout = 10 seconds #.
span = 1.0e + 6 # Hz
RBW = 100e3
averagingCount = 10instrSession = RFmxInstrMX(resourceName, '')
# configuration VSA
rbwAuto = RFmxSpecAnMXSpectrumRbwAutoBandwidth.True
rbwFilterType = RFmxSpecAnMXSpectrumRbwFilterType.Gaussian
averagingEnabled = RFmxSpecAnMXSpectrumAveragingEnabled.False
averagingType = RFmxSpecAnMXSpectrumAveragingType.Rms
#specAn = instrSession.GetSpecAnSignalConfiguration ();
specAn = RFmxSpecAnMXExtension.GetSpecAnSignalConfiguration (instrSession)
specAn.ConfigureRF('',centerFrequency,referenceLevel,externalAttenuation)
specAn.Spectrum.Configuration.ConfigureSpan('', span)
specAn.Spectrum.Configuration.ConfigureRbwFilter (", rbwAuto, rbw, rbwFilterType)
specAn.Spectrum.Configuration.ConfigureAveraging (", averagingEnabled, averagingCount, averagingType)
specAn.SelectMeasurements (", RFmxSpecAnMXMeasurementTypes.Spectrum, bool ())
specAn.Commit ("")# run acquisition
specAn.Initiate('','')# find the peak power in the spectrum
_, pkAmp, pkFreq, freqRes = specAn.Spectrum.Results.FetchMeasurement (", timeout, float (), float (), float ())
Print "peak power: dBm {:0.2f} to {:0.6f} GHz'.format(pkAmp,pkFreq*1e-9)}}""""
A .NET method may require user pass the variable name that it wishes to
change as an argument. Python is not compatible "pass by reference", but the
the variable name must exist in python, before he can be handed over to the .NET method.
The .NET method will simply point to the new instance.http://nbviewer.IPython.org/GitHub/jonnojohnson/Agilent/BLOB/master/Python_Automation/Python_Automation.ipynb
"""# create the name of the variable before you pass it to the method .NET
spectrum = RFmxSpecAnMXSpectrum# This does not work!
specAn.Spectrum.Results.FetchSpectrum (", timeout, spectrum)instrSession.Close)
Here is the error:
Traceback (most recent call changed):
File "
", line 3, in
specAn.Spectrum.Results.FetchSpectrum ("", timeout, spectrum)ArgumentException: Object of type 'System.RuntimeType' cannot be converted to type ' NationalInstruments.Spectrum'1 [System.Single] & ".
at System.RuntimeType.TryChangeType (Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.Reflection.MethodBase.CheckArguments (Object [] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, sig Signature)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture)
to Python.Runtime.MethodBinder.Invoke (inst IntPtr, IntPtr args, kw, MethodBase info, methodinfo MethodInfo [] IntPtr)Any ideas?
Ah! That's about all. Here's what worked:
spectrum = NationalInstruments.Spectrum [System.Single] (0)
_, spectrum is specAn.Spectrum.Results.FetchSpectrum('',timeout,spectrum)Here is the result and the final code for future reference:
import clr
import sys
Import os
import matplotlib.pyplot as plt
Import numpy as np# To Program Files Windows environment variable
Program_Files = os.environ ['ProgramFiles (x 86) ""]
assy_path = os.path.join (program_files,
"National Instruments",.
"MeasurementStudioVS2010,"
"DotNET"
"Assemblies."
'Current')sys. Path.Append (assy_path)
CLR. AddReference ("NationalInstruments.Common")
CLR. AddReference ("NationalInstruments.RFmx.SpecAnMX.Fx40")
CLR. AddReference ("NationalInstruments.RFmx.InstrMX.Fx40")from NationalInstruments.RFmx.InstrMX import *.
from NationalInstruments.RFmx.SpecAnMX import *.
import NationalInstruments
Import System# The VSA settings
resourceName = "5606_slave."
centerFrequency = 25.0e9 # Hz
referenceLevel = #-10 dBm
externalAttenuation = # 0.00 dB
Timeout = 10 # seconds
span = 1.0e + 6 # Hz
RBW = 100e3 # Hz
averagingCount = 10instrSession = RFmxInstrMX(resourceName, '')
# Get the model number
_, Model = instrSession.GetInstrumentModel (", Str())# configuration VSA
rbwAuto = RFmxSpecAnMXSpectrumRbwAutoBandwidth.True
rbwFilterType = RFmxSpecAnMXSpectrumRbwFilterType.Gaussian
averagingEnabled = RFmxSpecAnMXSpectrumAveragingEnabled.False
averagingType = RFmxSpecAnMXSpectrumAveragingType.Rms
specAn = RFmxSpecAnMXExtension.GetSpecAnSignalConfiguration (instrSession)
specAn.ConfigureRF('',centerFrequency,referenceLevel,externalAttenuation)
specAn.Spectrum.Configuration.ConfigureSpan('', span)
specAn.Spectrum.Configuration.ConfigureRbwFilter (", rbwAuto, rbw, rbwFilterType)
specAn.Spectrum.Configuration.ConfigureAveraging (", averagingEnabled, averagingCount, averagingType)
specAn.SelectMeasurements (", RFmxSpecAnMXMeasurementTypes.Spectrum, bool ())
specAn.Commit ("")# run acquisition
specAn.Initiate('','')# get x data
spectrum = NationalInstruments.Spectrum [System.Single] (0)
_, spectrum is specAn.Spectrum.Results.FetchSpectrum('',timeout,spectrum)# get data
analogwaveform = NationalInstruments.AnalogWaveform [System.Single] (0)
_, analogwaveform is specAn.Spectrum.Results.FetchPowerTrace('',timeout,analogwaveform)close a session #.
instrSession.Close)# calculate the frequency and power
startFrequency = spectrum. StartFrequency
frequencyIncrement = spectrum. FrequencyIncrement
sampleCount = spectrum. SampleCount
stopFrequency = startFrequency + frequencyIncrement *(sampleCount+1)
freqArray = np.linspace (startFrequency, stopFrequency, sampleCount)
current = list (analogwaveform. GetRawData())results of tracking #.
XScale = 1e-3
PLT. Plot ((freqArray-centerFrequency) * XScale, Power, LineWidth = 2.0)
#plt.ylim(referenceLevel-100.,referenceLevel)
PLT.yticks (NP.linspace(referenceLevel-100.,referenceLevel,11))
PLT.xticks(NP.linspace(-span,span,11)/2*XScale)
PLT. XLIM(-span/2*XScale,span/2*XScale)
PLT. Grid (true)
PLT.xlabel (' from center frequency (kHz) ")
PLT.ylabel ('Power (dBm) ")
PLT.title ("{} {:0.6f} GHz spectrum".format(model,centerFrequency*1e-9), fontsize = 'medium')
PLT. Show() -
Nican.dll call python questions
Hi all
I have a feeling that this issue will be left without an answer, but I'll ask anyway.
For a project, I need to use Python2.7 to receive frames from a bus. What I have to do is monitor CAN all traffic on the bus, I have to send frames. I searched (and searched and searched) for some sort of solution to this, but have found none. Here's the code I have so far:
Test #CAN using Python
types import *.
import table *.#Load DLL
CANdll = cdll. LoadLibrary ("NICAN.dll")canName = c_char_p ("CAN0")
canNumAttr = c_ulong (8)# Define constants
NC_TRUE = c_ulong (1)
NC_TRUE = c_ulong (0)
NC_CAN_MASK_STD_DONTCARE = c_ulong (0x00000000)
NC_CAN_MASK_XTD_DONTCARE = c_ulong (0x00000000)# The values taken from nican.h
#NC_ATTR_BAUD_RATE = c_ulong (0 x 80000007)
#NC_ATTR_START_ON_OPEN = c_ulong (0 x 80000006)
#NC_ATTR_READ_Q_LEN = c_ulong (0 x 80000013)
#NC_ATTR_WRITE_Q_LEN = c_ulong (0 x 80000014)
#NC_ATTR_CAN_COMP_STD = c_ulong (0 x 80010001)
#NC_ATTR_CAN_MASK_STD = c_ulong (0 x 80010002)
#NC_ATTR_CAN_COMP_XTD = c_ulong (0 x 80010003)
#NC_ATTR_CAN_MASK_XTD = c_ulong (0 x 80010004)# instantiate the table a
canAttrIdList = (c_ulong * 8))# Fill the values in the table
canAttrIdList [0] = c_ulong (0 x 80000007)
canAttrIdList [1] = c_ulong (0 x 80000006)
canAttrIdList [2] = c_ulong (0 x 80000013)
canAttrIdList [3] = c_ulong (0 x 80000014)
canAttrIdList [4] = c_ulong (0 x 80010001)
canAttrIdList [5] = c_ulong (0 x 80010002)
canAttrIdList [6] = c_ulong (0 x 80010003)
canAttrIdList [7] = c_ulong (0 x 80010004)#NC_ATTR_BAUD_RATE = 500000
#NC_ATTR_START_ON_OPEN = NC_TRUE
#NC_ATTR_READ_Q_LEN = 100
#NC_ATTR_WRITE_Q_LEN = 0
#NC_ATTR_CAN_COMP_STD = 0
#NC_ATTR_CAN_MASK_STD = NC_CAN_MASK_STD_DONTCARE
#NC_ATTR_CAN_COMP_XTD = 0
#NC_ATTR_CAN_MASK_XTD = NC_CAN_MASK_XTD_DONTCARE# instantiate table a
canAttrValueList = (c_ulong * 8)# Fill the values in the table
canAttrValueList [0] = 500000
canAttrValueList [1] = NC_TRUE
canAttrValueList [2] = 100
canAttrValueList [3] = 0
canAttrValueList [4] = 0
canAttrValueList [5] = NC_CAN_MASK_STD_DONTCARE
canAttrValueList [6] = 0
canAttrValueList [7] = NC_CAN_MASK_XTD_DONTCAREreturnValue = CANdll.ncConfig (canNumAttr, canAttrIdList, canName, canAttrValueList)
CODE ##END
Which causes this error:
Traceback (most recent call changed):
File "C:\Users\Chadwick\Dropbox\Senior Project\CAN\NI-CAN\ITB CAN\test.py", line 63, in
returnValue = CANdll.ncConfig (canNumAttr, canAttrIdList, canName, canAttrValueList)
ValueError: Procedure called with not enough arguments (missing 16 bytes) or bad calling conventionIt seems that I am not calling the function correctly.
Yes, I understand that nor is not supported by the Python. However, any help with this is appreciated.
Thank you
He is the labour code. I question the material for how many images of waiting there, then read them individually as I'm having no luck using ncReadMult. If someone needs to do this, here's a starting point.
/thread
types import *.
import table *.
import sys
import of struct
time of import#Load DLL
CANdll = windll. LoadLibrary ("NICAN.dll")NC_ST_READ_AVAIL = c_ulong (0x00000001)
NC_ATTR_READ_PENDING = c_ulong (0 x 80000011)# HEADER INFORMATION RELEVANT C
# typedef NCTYPE_INT32 NCTYPE_STATUS;
# typedef NCTYPE_UINT32 NCTYPE_OBJH;##typedef struct {}
# NCTYPE_ABS_TIME Timestamp;
# NCTYPE_CAN_ARBID ArbitrationId;
# FrameType NCTYPE_UINT8;
# NCTYPE_UINT8 DataLength;
# NCTYPE_UINT8 data [8];
#} NCTYPE_CAN_STRUCT;class CAN_STRUCT (Structure):
_fields_ = [("Timestamp", c_ulonglong),
("ArbitrationId", c_ulong);
("Frames", c_ubyte);
('DataLength', c_ubyte);
(«Données», c_ubyte * 8)]CAN_receive_buffer = (CAN_STRUCT * 1000))
Status = c_long (0)
CAN_HANDLE = c_ulong (0)
#CAN_data_size = c_ulong (sys.getsizeof (CAN_receive_buffer))
CAN_data_size = c_ulong (17600)CAN_received_size = c_ulong (1)
CAN_NAME = c_char_p ("CAN0")
canNumAttr = c_ulong (8)# Define constants
NC_TRUE = c_ulong (1)
NC_FALSE = c_ulong (0)
NC_CAN_MASK_STD_DONTCARE = c_ulong (0x00000000)
NC_CAN_MASK_XTD_DONTCARE = c_ulong (0x00000000)# The values taken from nican.h
#NC_ATTR_BAUD_RATE = c_ulong (0 x 80000007)
#NC_ATTR_START_ON_OPEN = c_ulong (0 x 80000006)
#NC_ATTR_READ_Q_LEN = c_ulong (0 x 80000013)
#NC_ATTR_WRITE_Q_LEN = c_ulong (0 x 80000014)
#NC_ATTR_CAN_COMP_STD = c_ulong (0 x 80010001)
#NC_ATTR_CAN_MASK_STD = c_ulong (0 x 80010002)
#NC_ATTR_CAN_COMP_XTD = c_ulong (0 x 80010003)
#NC_ATTR_CAN_MASK_XTD = c_ulong (0 x 80010004)
#NC_ATTR_LISTEN_ONLY 0 X 80010010# instantiate the table a
canAttrIdList = (c_ulong * 9))# Fill the values in the table
canAttrIdList [0] = c_ulong (0 x 80000007)
canAttrIdList [1] = c_ulong (0 x 80000006)
canAttrIdList [2] = c_ulong (0 x 80000013)
canAttrIdList [3] = c_ulong (0 x 80000014)
canAttrIdList [4] = c_ulong (0 x 80010001)
canAttrIdList [5] = c_ulong (0 x 80010002)
canAttrIdList [6] = c_ulong (0 x 80010003)
canAttrIdList [7] = c_ulong (0 x 80010004)
canAttrIdList [8] = c_ulong (0 x 80010010)#NC_ATTR_BAUD_RATE = 500000
#NC_ATTR_LISTEN_ONLY = NC_TRUE
#NC_ATTR_READ_Q_LEN = 100
#NC_ATTR_WRITE_Q_LEN = 0
#NC_ATTR_CAN_COMP_STD = 0
#NC_ATTR_CAN_MASK_STD = NC_CAN_MASK_STD_DONTCARE
#NC_ATTR_CAN_COMP_XTD = 0
#NC_ATTR_CAN_MASK_XTD = NC_CAN_MASK_XTD_DONTCARE# instantiate table a
canAttrValueList = (c_ulong * 9)# Fill the values in the table
canAttrValueList [0] = 500000
canAttrValueList [1] = NC_TRUE
canAttrValueList [2] = 100
canAttrValueList [3] = 0
canAttrValueList [4] = 0
canAttrValueList [5] = NC_CAN_MASK_STD_DONTCARE
canAttrValueList [6] = 0
canAttrValueList [7] = NC_CAN_MASK_XTD_DONTCARE
canAttrValueList [8] = NC_FALSE# Configure the equipment CAN
Status = CANdll.ncConfig (canNumAttr, canAttrIdList, CAN_NAME, canAttrValueList)
If Status! = 0 :
"Printing on"ncConfig"error
Status of printingStatus = CANdll.ncOpenObject (CAN_NAME, byref (CAN_HANDLE))
If Status! = 0 :
"Printing on"ncOpenObject"error
Status of printing
impression CAN_HANDLE.valueTime.Sleep (1)
Try:
Status = CANdll.ncAction (CAN_HANDLE, c_ulong(0x80000001), 0)
If Status! = 0 :
"Printing on"ncAction:start"error
Status of printing
impression CAN_HANDLE.valueI have = 0
##string = "" data: "".
String = «»pending_CAN_frames = c_ulong (0)
while I<>
Status = CANdll.ncGetAttribute (CAN_HANDLE, NC_ATTR_READ_PENDING,
32, byref (pending_CAN_frames))
Print "waiting for frames: %d" % pending_CAN_frames.value
If Status! = 0 :
"Printing on"ncGetAttribute"error
Status of printing
for n in range (0, pending_CAN_frames.value):
Status = CANdll.ncRead (CAN_HANDLE, CAN_data_size,
ByRef (CAN_receive_buffer [n]))
for n in range(0,pending_CAN_frames.value):
for j in range (0, CAN_receive_buffer [n]. DataLength):
String = string + '%x' % (CAN_receive_buffer [n]. Data [j])
print '% X\t%d\t%s' % (CAN_receive_buffer [n]. ArbitrationId, CAN_receive_buffer [n]. DataLength, string)
String = ' ' #reset chain
I += 1# ALWAYS CALL LAST
Finally:
Status = CANdll.ncCloseObject (CAN_HANDLE)
If Status! = 0 :
"Printing on"ncCloseObject"error
Status of printing/thread
I hope this helps someone in the future.
-
RS 232 to control E3633A PS error: 511
Goal: to write a short python script to create a loop of Regulation of the PD for the temperature.
PS: Aligent E3633A
Software: pyserial (python) or 232Analyzer (both producing identical errors)
System: win7 64-bit
Serial adapter: USB to serial: Belkin N10117, driver used:
COM port: 9 (also tried 10, another USB port of course)
Baudrate: 2400 (also tried 9600)
Data bits: 7 (also tried 8)
Parity: Even (also tried no peers and odd)
Stop bit: 1 (also tried 2 and 1.5)
Please forgive me, I'm a noob in series.
When I write in ASCII: SYST:BEEP (with pyserial prompt cmd or 232Analyzer), feeding by report an error-511. I looked in the manual of the PS and the error is an error 'Framing '. I double and triple checked my connections and settings (COM, Baudrate, parity, data bits) on the computer and the PS. I also tried to change the data to 8 bits, and the results were much worse. With the data bits, the value 8 with no parity, the PS most of the time would be inadmissible for sent orders. I tried many different commands for the PS, but each order I send gives me error 511. I have not been able to root causes this, but it seems to be a very simple thing to control this power by using RS232.
Note: The GPIB is not an option for me because of the cost.
Thanks for any help you can provide. I can provide more details if requested pyserial/232Analyzer. = D
-Andy
Problem solved!
Parameters which resolved:
You will need TO USE: 8 bits no parity, no matter what output baud rate and character of endpoint \n
Had too many problems entering the stop of
character in the 232Analyzer. Pyserial used instead. I don't understand why 7 bit + parity does not work, but it is not too much on are because it works with 8-bit.
Thank you markus kossmann for your advice. It helped a lot.
Maybe you are looking for
-
How to use a blank disc DVD-R as a USB flash drive?
Hi all! I'm running Mac OS X 10.9.5 on my MacBook Pro and I was wondering how I could use a blank DVD-R disc as a form of rewriting for documents, music, spreadsheets, etc. ? My mac Let's burn me to the disc, but I can't rewrite to it after that. Hel
-
Why my email, log in and become very weak message page?
When I click on mail on my homepage to the log in window opens. The window, but above all the type is much smaller than it used to be. When I connect and my e-mails appear, the type is too small to read. Yesterday, everything was fine. I got a messag
-
ThinkPad X Tablet 230 - monitor problem
My office starts but nothing appears on the screen. Please help me. Thank you.
-
Hi all, I have recently experienced some of the problems reported here: - Windows update doesn't work (stuck at 0% for the hours) - Windows cannot stop ("preparing to set up Windows. Please don't turn off your computer") - MSE is out of date - I can'
-
My programs won't install correctly
I try to install some problems such as safari from apple or other programs, he said that there is a problem with windows install.And other times, it installs the program, and if I turn of my computer and restarts it and try to run the program, which