|
|
I want read digital input status from Advantech PCI card,
but I have error like this:
"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
//My Device configuration******************
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BoardID"=dword:00000087
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADSDAQ\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BoardID"=dword:00000087
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADS1730S]
"Type"=dword:00000001
"Start"=dword:00000002
"Group"="Extended Base"
"ErrorControl"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ADS1730S\Device000]
"DeviceName"="PCI-1730 SwitchID=0 I/O=5000H"
"DriverName"="ADS1730.dll"
"KernelKey"="ADS1730S"
"BaseAddress"=dword:00005000
"BoardID"=dword:00000087
"SwitchID"=dword:00000000
"AllowConflicts"=dword:00000001
"Interrupt"=dword:00000000
"TimerClock"=dword:0000000a
"OnSystem"=dword:00000001
"BusNumber"=dword:00000000
"SlotNumber"=dword:00000000
"CardNo"=dword:00000000
"Trigger Mode"=dword:01010101
000:
My Code:********************************************************,
//Import dll********************
[DllImport( "adsapi32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi )]
private static extern int DRV_DeviceOpen( int DeviceNum, ref int DeviceHandle );
[DllImport( "adsapi32.DLL", SetLastError = true, CallingConvention = CallingConvention.Winapi )]
private static extern int DRV_DioReadBit( int DriverHandle, ref PT_DioReadBit lpDioReadBit );
[StructLayout( LayoutKind.Sequential )]
public struct PT_DioReadBit
{
public UInt16 port; //USHORT port;
public UInt16 bit; //USHORT bit;
public IntPtr state; //USHORT far *state;
}//PT_DioReadBit, FAR * LPT_DioReadBit;
**********USING********:
int errCde;
int driverHandle = 0;
int deviceNum = 0;
errCde = DRV_DeviceOpen( deviceNum, ref driverHandle );
PT_DioReadBit readBit = new PT_DioReadBit();
readBit.port = 0;
readBit.bit = 0;
errCde = DRV_DioReadBit( driverHandle, ref readBit );
int value = readBit.state.ToInt32();
modified on Wednesday, April 2, 2008 10:06 AM
|
|
|
|
|
arturw82 wrote: int driverHandle = 0;
int deviceNum = 1;
errCde = DRV_DeviceOpen( deviceNum, ref driverHandle );
Considering you're using an arbitrary handle and not a handle that's returned from the driver, it's no surprise that you're getting this message. Is it documneted anywhere that the driver handle will always be 0?? I doubt it... The same is true for the device number.
Your single best source of information on this is going to be the manufacturer of the board and the library you have to use to talk to it. Since your applciation is so very specific to a single piece of rarely-seen hardware, it's very unlikely your post is ever going to be seen by anyone with first-hand knowledge on using it.
|
|
|
|
|
Sorry, this error i have when deviceNum = 0;
When deviceNum = 1 i have error code "30" from function DRV_DioReadBit "Invalid driver handle"
|
|
|
|
|
Ok, great. This still doesn't change the fact that you're asking the wrong group of people for help with a very specific piece of hardware.
|
|
|
|
|
Hello all,
I have got 2 problems while working with crystal reporting in C#. I am a beginner with C# and crystal report
1. In my software every user has to be signed in with an ID and password. Now how can I show one particular user's report in crystal report. As a beginner I have used the wizard. But using the wizard I can show the full data table but not the data of a particular user with photograph.
2. I am using dotnetcharting class library for charting in my software. How can I include this tool in crystal report? In the report more than one charts will show the data of a particular user (who is signed in).
Please help me to solve this out
Thanks in advance
Faysal,
MSc Candidate, U-Health Lab,
Department of Biomedical Engineering,
Kyung Hee University, South Korea.
email: faysal_002299@yahoo.com
|
|
|
|
|
as far as the execution speed is concerned , should we use the crystal reports ?
I think , the exporting concepts should be implemented , over the crystal reports.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
hello,
How can i display my word document that contain text and images into my richtextbox?
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Save the word document as RTF and open it up in the RTB.
|
|
|
|
|
but can this save method made automaticaly in the c# application or into a buffer without putting data into ma disk
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
There are several controls on codeproject that allow to display word files. Use search to find them.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hi,
Please can anyone got answer of the following issue:
I have developed a Web Part in SharePoint using C#.Net. A TreeView control I have created which is pointing to some directories. Created an event of the TreeView (SelectedNodeChanged) Which is not firing all the time. Sometime it fires and sometime its not. I cant figure out the reason of such abnormal behavior. Find the attached code. Please help.
--------------------------------------------------------------------
CreateChildControl
{
Some More Codes here.....
TreeViewReportListTree.SelectedNodeChanged += new EventHandler(TreeViewReportListTree_SelectedNodeChanged);
Controls.Add(TreeViewReportListTree);
Some more codes here.....
}
----------------------------------------------------------------------
|
|
|
|
|
click Export.
Click Export to a file, and then click Next.
Click Comma Separated Values (Windows), and then click Next.
In the folder list, click the Contacts folder, and then click Next.
Browse to the folder where you want to save the contacts as a .csv file.
Type a name for the exported file, and then click OK.
Click Next.
Click Finish.
|
|
|
|
|
|
i am exporting the gridview data to excel in c#.Along with this , i am sending the heading also .so far , it is working very fine.
Problem is , the heading is comming in the first cell , I mean , i need to merge the first row .Can u help me ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Hello
Does anybody no when serializing a class how to correctly add attributes the the parent element.
E.g.
<Root SchemaVersion="1.0">
<child>
</child>
</Root>
For the life of me I cannot get the SchemaVersion="1.0" to appear. Any help would be greatly appreciated.
Many thanks.
|
|
|
|
|
have you tried marking a property called "SchemaVersion" in your object with the XmlAttribute attribute?
|
|
|
|
|
I have a datagridview in my form. I have a Clear button and I would like the datagridview to clear its contents when I click the button. I have tried datagridview1.Rows.Clear() but nothing happend. I have also set the datagrids source to null but still nothing. Any help will be appreciated
|
|
|
|
|
Hi,
IMO there are two ways:
- when bound to a datasource, clear the datasource
- or clear the binding, then do Rows.Clear()
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: Hi,
IMO there are two ways:
- when bound to a datasource, clear the datasource
- or clear the binding, then do Rows.Clear()
Luc Pattyn [Forum Guidelines] [My Articles]
Thanks Luc! After clearing the datasource I then used the Rows.Clear(0) : and it works 100%
|
|
|
|
|
Hi, i have a math question. Can i find the roots of inequalities in C# - is there any algorithm. For example the equation is
x^4 + 3*x^2 + 8 > 0 or sin(2*x) + cos(3*x) < 1
...
How can i find with a program the roots of these inequalities?
I need to know this because i am writing a program which draws math graphs. It can draw inequalities (for example sin(2*x) < cos(x) ) and mark the intervals at which inequality has roots (where sine is smaller than cosine from the example). The hard part is that i can't find the points where the inequalities intersect - i can't find the bounds of the intervals where the solutions are.
Still learning...
|
|
|
|
|
Hi,
you can solve a small fraction of all possible equations analytically; e.g. your first
example is a quadratic equation, where x^2 is the unknown. Since the discriminant is
negative, it will have four complex solutions, no real ones.
Your second example can be transformed into a pair of equations in s and c, where
s=sin(x) and c=cos(x), the second equation being s*s + c*c = 1
For plotting purposes you don't really need an analytic solution; you can just somehow
define the range that interests you, and calculate the function for several values inside
that range.
And you can always try and solve an equation of the form f(x)=0 by an iterative
approach, see e.g. Newton-Raphson algorithm.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
you could try using the api for something like matlab, but I suspect MatLab is very expensive, I've only every used a copy in a university computing lab.
Otherwise You'll need to write code to solve general cases of each equation or an algebra module to rearrange the equations into a general case.
As Luc has already said something like Newton Raphson might be a good idea but you need to have a rough idea of where the roots are inorder to find all of them
HTH
Russell
|
|
|
|
|
Clicking on the Export button will show a window in which to set the name of the exporting file. The Field delimiter will also need to be specified (the column separator character) and you will also be able to specify whether First row contains field names. Finally, you’ll be able to select the fields to be exported and, after clicking on the Next button, exporting process will start.
|
|
|
|
|
Smells like an assignment. Anyway, Google is your friend as well as codeproject.
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|