Quantcast
Channel: Digital I/O topics
Viewing all 2178 articles
Browse latest View live

NI-845x I2C Slave implpementation examples - C

$
0
0

Good afternoon,

 

For the last few weeks my team has been using USB-8451 Interface to test and read up the statuses of some circuits we have made. Up until this point I have been using NI-845x 2.1 drivers, and a GUI created by myself in Visual Studio C++ using the C I2C API.

 

However, now I have to test the Master circuits by simulating a Slave device, and so USB-8452 was ordered last week. It came with the 14.0 drivers which we have installed. Unfortunately I am having a few problems with getting my code to work to successfully implement a Slave device.

 

My questions is, are there any examples available of Slave I2C devices implementation using C? Either official NI ones, or made by someone from the community. I hoped that maybe updating the drivers would add some new ones to the 'Examples' folder I have found, but it seems like the folder has been untouched since installing the 2.1 software.

 

Thank you very much for any help,

 

Konrad


digital output fixed width pulse NIDAQmx

$
0
0

Dear NI forum members,

 

I am using NIDAQmx C API to implement a behavioural driving program. I would like to monitor a digital input port for an event, and every time a trigger exist I would like to generate a discrete digital pulse of some define width (e.g. 0.1 sec). The PCIe card is named NI PCIe 6321 from the X-series. And the connector block is called NI BNC-2110. Here how far I am now:

 

/* configure read port task */
DAQmxErrChk(DAQmxCreateTask("ReadPort", &readPort));
DAQmxErrChk(DAQmxCreateDIChan(readPort, "Dev1/port0/line0:7", "", DAQmx_Val_ChanPerLine));
DAQmxErrChk(DAQmxCfgChangeDetectionTiming(readPort, "Dev1/port0/line0", "", DAQmx_Val_ContSamps, 1));
DAQmxErrChk(DAQmxRegisterSignalEvent(readPort, DAQmx_Val_ChangeDetectionEvent, 0, ChangeDetectionCallback, state));

/* configure write port task */
DAQmxErrChk(DAQmxCreateTask("WritePort", &writePort));
DAQmxErrChk(DAQmxCreateDOChan(writePort, "Dev1/port1/line0:7", "", DAQmx_Val_ChanForAllLines)); # in the Callback function write to digital line

/* change detection callback function */
int32 CVICALLBACK ChangeDetectionCallback(TaskHandle taskHandle, int32 signalID, void *callbackData)
{
    uInt8 data[8] = {0};
    int32 numRead;
    unsigned char lineBits = 0x01;
/* read port at event */ if (taskHandle) { DAQmxErrChk(DAQmxReadDigitalLines(taskHandle, 1, 10.0, DAQmx_Val_GroupByScanNumber, data, 8, &numRead, NULL, NULL)); /* if any bits changed trigger a pulse */ if (numRead) { DAQmxErrChk(DAQmxStartTask(writePort)); DAQmxErrChk(DAQmxWriteDigitalU8(writePort, 1, 1, 10.0, DAQmx_Val_GroupByChannel, &lineBits, NULL, NULL)); /* somewhere here update lineBits to ground (0) level and write after some time */ # pulse width time delay ??? also I do not want to use a delay command inside the callback function # will it keep it blocked if event arrived while it is being delayed lineBits = 0x02; DAQmxErrChk(DAQmxWriteDigitalU8(writePort, 1, 1, 10.0, DAQmx_Val_GroupByChannel, &lineBits, NULL, NULL)); DAQmxErrChk(DAQmxStopTask(writePort)); } } return 0; }

 

Any help or direction will be helpful! Thank you in advance!

 

Best,

Georgi

to control the voltage can we use usb-6001?

$
0
0

where can i find the usb-6001's software and driver?

 

How to prevent a value in shift register being updated?

$
0
0

Hi Fellow NI Users,

 

I'm new to LabView graphical programming and Hardware Acquisition. After reading through the basics of loops, data strcutures and data flow I'm still at lost of what I'm trying to achieve. 

 

I am using a DAQ to acquire digital signal from set of relays. When the relays turns on, it generates a 1, and when it turns off it genereates a 0.  I also have a counter to keep the edges of the relay flipping. The relays are flipping on and off every 4 mins. 

 

However, over the course of the night a relay may misfire and the count would not match up. I want to write a LabView program that would stop the test when the relay cont mismatches. 

 

This is what I have gotten so far. 

Relay_Count_Comp_01.JPG

 

The concent is easy, take the current 1-D array and compare with the previous array, if one of the element in current 1-D array is the same as the previous element, then I know there is a relay misfire. 

 

Problem is, the array from previous shift register is constantly being updated since the DAQ is continuously acquiring signals. 

 

How can I take the 1-D array of the counter from the previous read without being overwritten? 

 

Cheers,

Leon

Can a NI 9403 be used for arbitrary time length 5v square wave output?

$
0
0
I have a cDAQ-9178 with NI 9403 module. I would like to use this module to output a 5v square wave for an arbitrary amount of time. I have tried a few methods with the most recent being a program very similar to this example : https://decibel.ni.com/content/docs/DOC-25288 . The differences being I simply fed the write a Boolean true and had it in a timed loop. Upon testing the program and monitoring the output with a BK 2553 I found that I would either get a single 2v spike or a ~1V_pp_max oscillation about the ground. I tried it on two different channels and received the same results. Please advise.

NI-8452 Slave continuously waiting for event - I2C

$
0
0

Hello,

 

Recently I have been working on a I2C Slave simulation for one of my Master circuits, using the NI-8452 Interface. I have created a GUI in the Visual Studio 6 C++ and I am capable of setting up the Slave, waiting for an event from the Master and writing the data to it following the data request event. However, I have a problem with getting the procedure to run continuously - every time after sending the data I would like the Slave to be waiting for an event once again. I've tried using several 'for' and 'while' loops but I seem to be getting some synchronization problems with my Master - commands end in errors and crashes.

 

I guess my questions is about any potential examples available, demonstrating a continuous wait for a request from the Master, replying to that request and then going back to the waiting state.

 

Best regards,

 

Konrad

Count digital I/O for a certain period

$
0
0

Hi, 

Im challanged with LabView and I need to count a digital period. Im supposed to count number of cycles on a motor that switch from left to right. Each cycle is one left/right iteration. My challange is that, on my system there is som spikes, so i need to count for some ms or x number of samples to be sure, that I have an high- or low-level. This at the moment my main task..

Further I need to count one up for each cycle and show it. Later I also need to save the exact number of which cycle the connection is lost.. 

I tried to illustrate my signal with the time and the spike.

DigitalSignal.PNG
The whole systems is sopposed to chech the connection in a USB cable and it's also connected to a DAQ USB-6009. 

I have LabView 15, so I created some snippets which I hope you can see or open. The first image is my first steps and the second image is the whole code. 
FirstSteps

Complete system:

CompleteSystem.png

 

Please share your ideas and you most welcome to come with examples Smiley Happy 

Thanks in advance

Connection to Beckhoff BK9100

$
0
0

Hello,

 

i am totally new to LabVIEW and i have many question.

 

But first i want to know how can i realise a communication between Labview and the Beckhoff BK9100. I only want to set an input to bring the Led to flash at the Bk9100?

 

I can Ping to the Buscoupler but with the ip adress i dont find it at the Measurement and Automation Explorer under "Network Devices".

 

Maybe its to simple but i really have know idea!

 

Thanks for support.

Patrick


PCI-8335 (MXI-3) when the optical fiber is connected to the card PCI8335 -> PC freezes

$
0
0

When I connect the optical fiber on the PCI8335 card, the PC DELL Vostro 220 Mini Tower Desktop freezes (software, keyboard, mouse)
If during startup, the fiber is not connected, the PC starts and everything works normally (with the exeption of communication and National Instruments application because the fiber is not connected)
If I plug the fiber when the PC is completely started, the 2 LEDs light; then when I run the MX-3 application, the PC freezes.
Does the PCI-8335 card is down or is it another problem? Thank you in advance for your help.

SCXI-1163R Problems

$
0
0

I have an SCXI-1163R with a SCXI-1326 terminal block in a SCXI-1001 chassis with Labview 2014.  I've set up a VI with a toggle button that switches (for example) ch12 to com3 using the niSwitch Connect Channels VI.  I'm checking for continuity between ch12 and com3 with a multimeter and I'm getting some really weird problems.

 

If I switch ch12 to com3 by enabling my switch button, I read about 370kohm between ch12 and com3.  If I disable the switch button, I read 6 ohms.  This is backwards from what is expected, and even then it's never truly open.  If I reboot the chassis, it will read open.  If I check the switch status in NIMax, it will show connected when my button is disabled, and it will fluctuate between open and connected when my button is enabled.  

 

I've tried multiple channels and they all do the same thing.  I've attached the VI that I am using.  I've searched everywhere and haven't found a solution, and the example VI is too old for my version.  Thanks for any help.

i2C Digital Potentiometer

$
0
0

Hi All,

 

I'm trying to setup a simple VI on a myRIO-1900 to use a digital potentiometer as a variable resistor. I have preciously used an SPI dpot with success however I am having issues when switching to an i2C controlled dpot.

AD5241 pinout.PNG

Following the datasheet found here ( http://www.analog.com/media/en/technical-documentation/data-sheets/AD5241_5242.pdf ) I have made the following connections.

 

[1] A1 -> 5V
[2] W1 -> Analog Input
[3] B1 -> DGND
[4] Vdd -> 5V
[5] SHDN -> Vdd (5V)
[6] SCL -> [32] I2C SCL
[7] SDA -> [34] I2C SDA
 
[8] AD0 -> 0V analog output
[9] AD1 -> 0V analog output
[10] DGND -> DGND
[11] Vss -> DGND
[12-14] -> No connections
 
When I make these connections and run the following VI with the i2C express VI set to write, I end up reading a constant voltage which does not change with variation of the 8bit vertical point slide input. Furthermore, I am experiencing some chip overheating if the VI runs for too long which shouldn't be occuring. 
 
i2c dpot.PNG
There are several areas which I think the error may be arising from:
 
1. Pinout connections outlined above are incorrect.
2. The slave address is incorrect. I am unsure whether I should be sending analog or digital outputs to the AD pins to define the slave address. the datasheet states " Package pin programmable address bits. Must be matched with the logic states at Pin AD1 and Pin AD0." I hav e set both to a logic low (I think) and therefore assume that AD0 and AD1 are 00. So the slave address bit is 01011 then 00 whch is 255. I have also tried setting both to boolean false with a digital output but I expereince the same problems.
3. Incorrect soldering. The chip is a SOIC chip and I have hand soldered it onto an adaptor board (winslow w9502RC) so that I can sit it into my breadboard.
 
Does anyone have an idea what the problem/s might be?
 
Cheers,
Ben

 

Error 200452 with Pause Triggered DI on PCI-6251

$
0
0

Hey guys,

 

I am writing a program to snoop on the SPI communication between a microcontroller and two MAX-7221 display drivers. Essentially, I want to read the Din pin of both chips and convert the data streams into the corresponding numbers that are being displayed on the devices front pannel (each chip controls two 3 digit numbers, 6 digits in all). The data is 16 bits and contains a 4 bit address and a 4 bit code B representation of the number. I recognize both of those values in the vi, convert the code B into decimal, and use the address to combine each digit into corresponding 3 digit numbers that I can display and save to a file.

 

Each chip has a Din line that contains the data, a clock, and a load signal (called CS). In my vi I aquire data using the external clock signal and use a pause trigger to aquire only when CS is low. This worked perfectly for collecting data from one MAX-7221 chip, but I started to run into problems when trying to aquire data from both chips simultaneously. 

 

Since I am using two differnt clock and trigger signals, I couldn't use a single DAQ. I had a PCI-6251 laying around and decided to use that to aquire from one chip and my original USB-6361 to aquire from the other. Aquiring data from either chip with the USB-6361 works perfectly, but when I try to aquire from both DAQs simultaneously I get Error 200452 associated with the PCI-6251 pause trigger.

 

I have been doing a ton of digging, but I can't seem to figure out what the issue is. The NI website says that the PCI-6251 supports pause triggering, and no matter what channel I use I still get the same error. I even tried to use other types of triggers, but no matter what I do I get Error 200452.

 

Thoughts?

 

Thanks in advance!

Colin

USB-6501 writing a byte

$
0
0

Hello,

 

i have a USB-6501.

 

i would like to write a sequence of "1's" and "0's" to form a byte

 

so for example i would like the 6501 to write say 1001000 or 11100110 using the digital outputs so "on" "off" "off" etc

 

thanks

 

COM carte NI9375

$
0
0

Bonjour,

Sur une carte NI9375, j'aurai voulu savoir si le "DI COM" et le "DO COM" sont au même potentiel et donc liées en interne de la carte.

Merci de vos réponses

Cordialement

Sébastien

Is there any sbRIO 9636 daughter board Multisim template available?

$
0
0

HI all,

       I am intended to design my own daughter board for the sbrio9636 but I could not found in the installed template of multidim 13.0. Is there available somewhere?

 

Zahari


Delete created TDMS file

$
0
0

Hi,

I have a question. In my VI I creat a TDMS file with measured values. After that I add these values to another TDMS file. I choosed this way because the others are to difficult. Anyway at the end of the VI I want to delete this created TDMS file because the values are in the other file and therefore I don't need the old file anymore. I can delete it outside Labview but I want to do this automatically. In other words I created a TDMS file in the beginning of the VI and want to delete it in the end. Is that possible?

Thank you for your help

Regards

pressure transducer question

$
0
0

Hi guys, does any of you have seen this kind of pressure transducer? (See the attachment) 

Mine was broken because one of the leads were completely fell off. So, I need to find a new one, but I can't find the part number. 

P.S All I can read on the transducer are some random words and numbers. Here is what I see if I place the opening toward the front. 

On the left side: 6ff8g; 201020n. On the back: Micro. On the right, blank. 

 

THANK YOU GUYS!!!!!! 

Incremental encoders with 9411 in scan mode

$
0
0

Hi.

I developped a project to control a plant using a controller NI9067 working in scan mode. Among the devices there is a NI 9411 to acquire pulses from incrmental encoders, so I have just chA and chB from encoder, no Z index, and i need to reset position in order to have the right reading of position. In Specialty Digital Configuration of 9411, the Quadrature function is performed for encoders with A, B and Z index. But I dont have Z index, so how to wire encoders signal to board and how to perform the reset operation?

Attached the vi I developped not in rt target to calculate position and reset procedure

Thank yo for your help

Looking for digital IO module and connector block with over 45 channels for FlexRIO FPGA

$
0
0

Greetings,

 

I'm building a laser scanning microscope system and would like to use NI FlexRIO FPGA (likely a 797xR) to digitally control the X/Y scanning mirrors and to acquire TTL pulses from three photon detectors. For that purpose, I'd need to have 40 digital output channels (16 data + 4 control channels for each mirror) and 3 digital input channels. I may also need a few more channels for shutter control, signal synchronization, etc. in the future. Therefore I have the following question:

 

1. I located NI 6581 and 6583 digital adapter modules. Which one would you recommend? Or is there a better option other than these two? 

 

2. How can I wire the adapter to peripheral devices (mirrors, detectors, etc)? Can I just insert single conductor wires directly to the module's DDC pins? If a connector block (like SCB-68A for R series FPGA) is needed, which one should I get?

 

Thanks,

Bing

Digital pins of sbRIO drop low when a "high" is given

$
0
0

Hello,

 

I use an SHT7X temperature/humidity sensor which gives digital output. The sensor has two digital lines, clock line and data line. The data line is bi-directional. A pull up resistor of 10k ohms across the data pin is used to drive the data high (voltage level =3.3v). The sensor works on an I2C (kind of) protocol.

 

The digital pin (here the data pin) of the sbRIO-9633 drops "low" when a high is sent through the program and remains "high" (due to the pull-up) when a "low" is sent to the pin through the program. What's the explaination? What happens when a pin is already high (due to the pull up) and the user also sends a high to it?

Does it drop to zero? Why?

 

 

Note: In the FPGA program, the data pin is configured accordingly. That is, the output setting (enable and disable) is configured according to its bidirectionality operation.

Viewing all 2178 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>