pallen Posted December 16, 2004 Report Posted December 16, 2004 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 Quote
Mark Balla Posted December 16, 2004 Report Posted December 16, 2004 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. Quote
pallen Posted December 16, 2004 Author Report Posted December 16, 2004 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. Quote
Mark Balla Posted December 17, 2004 Report Posted December 17, 2004 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. 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 Quote
pallen Posted December 17, 2004 Author Report Posted December 17, 2004 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.