Jump to content

Digital Output problems


pallen

Recommended Posts

Having a bit of a problem with writing to a digital line here for some reason. (6 digital lines actually)

The piece of code I'm working on is a state machine that once initiated, waits a random time between 1 and 6 seconds, then lights a random light between 1 and 6. (Turn on Light State) At the same time I'm lighting an LED on the screen, I'd like to enable a hardware LED.

I also need to reset the display and the LEDs at the beginning of each test.

The initial piece of code only enabled LEDs on the user screen. But now I'm to add actual hardware LEDs as well.

I can toggle the lights no problem using the Digital Line Write.vi, but only outside of my code. I've tried a number of different configurations from within my .vi but so far I haven't figured out what the problem is yet.

I think there may be a conflict with one Digital Line Read.vi I'm using in the code. Perhaps I cannot have both reads and writes on the same port?

I'm really hoping to have this working by Friday, otherwise the black belts I'm demonstrating the unit to might take it out on the poor programmer! :(

Any assistance would be greatly appreciated.

I'm including a current copy of my code. Code is written in LV 7.1

Download File:post-247-1103219859.vi

Link to comment
Having a bit of a problem with writing to a digital line here for some reason.  (6 digital lines actually)

The piece of code I'm working on is a state machine that once initiated, waits a random time between 1 and 6 seconds, then lights a random light between 1 and 6. (Turn on Light State) At the same time I'm lighting an LED on the screen, I'd like to enable a hardware LED. 

I also need to reset the display and the LEDs at the beginning of each test. 

The initial piece of code only enabled LEDs on the user screen.  But now I'm to add actual hardware LEDs as well. 

I can toggle the lights no problem using the Digital Line Write.vi, but only outside of my code.  I've tried a number of different configurations from within my .vi  but so far I haven't figured out what the problem is yet. 

I think there may be a conflict with one Digital Line Read.vi I'm using in the code.  Perhaps I cannot have both reads and writes on the same port?   

I'm really hoping to have this working by Friday, otherwise the black belts I'm demonstrating the unit to might take it out on the poor programmer!    :(

Any assistance would be greatly appreciated.

I'm including a current copy of my code.  Code is written in LV 7.1

3067[/snapback]

Just reviewing you code quickly I notice that you code doesn't tell the digital IO vis what device you are using so it will use what ever the default is set at. Try wiring the device or task into the vi and see if that helps.

Link to comment
Just reviewing you code quickly I notice that you code doesn't tell the digital IO vis what device you are using so it will use what ever the default is set at. Try wiring the device or task into the vi and see if that helps.

3069[/snapback]

Unfortunately I don't think I'm going to be able to figure this out in time. It looks like I can't use the simple vi's if I want to read and write on the same port. I haven't been able to figure out the advanced controls yet and it doesn't look like I will before time runs out.

Thanks for the reply though.

Link to comment

The reason the outputs don't turn on is because every time you use the Read from Digital Line vi all of the lines on that port are configured as inputs. In the "Turn on Light" case all lines are set as outputs and one is turned on. Then in "Initial React" case all lines are set as inputs which turns all lines off.

post-584-1103264425.png?width=400

Dig Multi-line Direction (E).vi from the example finder is a good example of how configure lines individually.

Only port 0 of the 6025E card will allow you to set each line as a input or output. port 1-3

will not.

I added the port config and read write vis to your original program.

let me know if it works or what your final solution turns out to be. :)

Download File:post-584-1103264401.vi

Link to comment
Dig Multi-line Direction (E).vi from the example finder is a good example of how configure lines individually.

That's exactly the example that helped me solve the problem late last night.

Using their example, I config the port only once and pass the taskID to the read and write commands. I'm my case I'm able to use constants for the Line Masks and Pattern inputs.

For some reason the code you uploaded gives me a group error when the Write block attempts to execute. I'll put up what I ended up going with just for interest's sake.

Thanks very much for your input! :thumbup:

Download File:post-247-1103301723.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.