02-28-2012 09:11 AM
Hello
I'm using this code for turn on the bits of Port0:
Private Sub TURN_ON (ByVal Line_Name As String)
Dim digitalWriteTask As New Task
Dim writer As New DigitalSingleChannelWriter(digitalWriteTask.Stream)
Select Case Line_Name
Case "Line0"
Try
digitalWriteTask.DOChannels.CreateChannel("Dev1/Port0/line0", "port0", ChannelLineGrouping.OneChannelForEachLine)
writer.WriteSingleSampleSingleLine(True, True)
Exit Sub
Catch exception As DaqException
MessageBox.Show(exception.Message)
Finally
digitalWriteTask.Dispose()
End Try
Case "Line1"
....................
....................
End select
End Sub
Private Sub TURN_OFF (ByVal Line_Name As String)
Dim digitalWriteTask As New Task
Dim writer As New DigitalSingleChannelWriter(digitalWriteTask.Stream)
Select Case Line_Name
Case "Line0"
Try
digitalWriteTask.DOChannels.CreateChannel("Dev1/Port0/line0", "port0", ChannelLineGrouping.OneChannelForEachLine)
writer.WriteSingleSampleSingleLine(True, False)
Exit Sub
Catch exception As DaqException
MessageBox.Show(exception.Message)
Finally
digitalWriteTask.Dispose()
End Try
Case "Line"
....................
....................
End Select
End Sub
BUT IT DON'T WORK FOR LINE 8....LINE15. WHY??
CAN YOU SEND ME A CODE EXAMPLE THAT TURN ON AND OFF ONE BIT AT TIME LINE 8....LINE15? THANKS
02-28-2012 01:56 PM
02-28-2012 01:56 PM
Hi,
02-28-2012 01:59 PM
Hi,
I know this doesn't solve your problem but you could reduce your code, both subs and all the select case code to one short sub.
Private Sub WritePort(ByVal Line_Name As String, ByVal Value As Boolean) Dim digitalWriteTask As New Task Dim writer As New DigitalSingleChannelWriter(digitalWriteTask.Stream) Dim Line As String = Line_Name.Substring(Line_Name.Length - 1, 1) Try digitalWriteTask.DOChannels.CreateChannel("Dev1/Port0/line" & Line, "port" & Line, ChannelLineGrouping.OneChannelForEachLine) writer.WriteSingleSampleSingleLine(True, Value) 'You don't need 'Exit Sub' here Catch exception As DaqException MessageBox.Show(exception.Message) Finally digitalWriteTask.Dispose() End Try End Sub
Sorry this doesn't solve your issue
Curt
03-01-2012 04:11 AM
Hello,
my problem is still unresolved...
What I must do for write from P0.8 to P0.15
Thanks
03-01-2012 11:08 AM
Hi,
I don't know what hardware you are using, but is it possible that there are two 8 bit ports on your device and not one 16 bit port?
If that is the case then try using something like this for bits 8 to 15
"Dev1/Port1/line0", "port1"
where line0 = line8 and line7 = line15
Curt
03-02-2012 06:36 AM
Hello peppepeazella,
in the following link you can find an example of how you can generate continuous analog waveform with variable rate internal clock using Visual Basic .NET
http://zone.ni.com/devzone/cda/epd/p/id/4775
I am also sending you a link where you will be able to find examples regarding DAQmx functions for .NET.
http://digital.ni.com/public.nsf/allkb/39F4B9264B94308C8625729D0067F9AF?OpenDocument
Please let me know if this is of assistance.
Thank you,
03-05-2012 04:39 AM
Sorry But I don't have found nothing that help me
I' have still the problem to drive P0.8 line
03-05-2012 06:26 AM
Hi,
What type of device are you using?
Curt
03-12-2012 02:28 AM
Hello
my hardware is USB - 6212
THanks