LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comparing digital input and output from two different DAQs

The LCD is to display the user's score and top score.

My initial plan was to ask the user to input their name, select the level, and the game starts automatically. THat is what we're doing now right? 

0 Kudos
Message 31 of 58
(1,070 Views)
I'm still having the no unique values problem. I opened both control and the main VI. The main problem lies in the VI i think where the Event structure values are still the ones from your old file. Can I change them? 
0 Kudos
Message 32 of 58
(1,066 Views)

I think the vi uses reference to a wrong typedef, so the elements doesn't correspond to the cases in the code 😞

 

When you place the mouse over any state machine relayted item (array or single element) the context help (Ctrl + H) should say Typedef 'def_StatesMainLoop.ctl'. Is that also the case with your code?

That control has 11 states from Idle to WriteToLeds, your case structure should have 11 cases, one for each state.

 

You better remove all the versions from your PC or at least rename the actual folder that you are using now, make a complete new folder and copy the latest versions of code and typedef into that folder.

 

 

 

The LCD vi's use hardware lines to write some data to an LCD display connect to a DAQ device, correct?

Are you sure that those lines are different than the ones used for your LED's & Buttons?

 

Place the Init LCD vi in the Init sequence of the code, state Init-Controls or Init-DAQmx, your choice

Place all the other vi's in the "WriteToLCD" state and call it when needed.

Use a new sting control "LCDMessage" to pass data between different states and the LCD state.

In the state that want to write someting to the LCD wirte the message in the "LCDMessage" control.

Wire that control to the "Input string" connector of the LCD Wrap vi.

Got this procedure? Good luck!

0 Kudos
Message 33 of 58
(1,058 Views)

THanks Alain, I removed the other versions and its working now.

The LCD is connected to a DAQ device.. I'm having a seperate DAQ for the LCD.. so far I havent tried using all 3 yet but shall do so either today or tomorrow.

 

I get what you mean about the LCD part and I'll do it and post it up here ASAP. 

0 Kudos
Message 34 of 58
(1,050 Views)
I've added in the LCD part, but it doesnt work.. next problem i'm having is with my buttons.. i've tried pressing them but it doesnt seem to read.. one more problem is when the game starts the counter does not countdown properly.. it starts at 59, jumps to 57, 55 etc etc.. can someone help me troubleshoot ASAP please? I've done so but I don't know where the error is .. thanks!
0 Kudos
Message 35 of 58
(1,032 Views)
here's my VI
Download All
0 Kudos
Message 36 of 58
(1,030 Views)

Hello,

 

I think i am late to the discussion, but its intresting one Smiley Happy !!

OK

1. Have you tested your LCD codes independently? i meant before integrating it to this code? have you seen whether the clock is working properly? Do you think there should be delay between the two VI's where you are making the pulse for the clock?

2. DI Read, Are you getting any specific error there? or it just reads 0? Probe the task where you create it and just before reading, just check what it displays.

3. Clock discrepeancy is bound to happen the way in which it has been implemented because it will always take different amount of time to execute different number of states before updating the clock value again.

 

Regards,

Krunal K Patel.

0 Kudos
Message 37 of 58
(1,021 Views)

Hi and welcome to the discussion 😃 

 

Everything works independently but there's errors when its being integrated into one big program =(   still trying to troubleshoot it 

0 Kudos
Message 38 of 58
(1,016 Views)

I looked at your code and see that you added two wait instructions with a delay of "LevelTimeOutTime".
One in state "Write to LEDs" and one in state "ReadFromPushButtons".

Why do you think you need those delays?

Now you're holding your code two times up. That's wrong, all timing stuff is done in the Timeout state of the event case in the Idle state of the statemachine.

 

I changed the following in the code:

a) The Idle state should also be the Default state, so I added Default in the selector.

b) I added 1 sate to the array with initial states and moved two others. It make more sence to first initialize the hardware before entering some user data.

c) I added one control so that you can see what's read by the DAQmx read push buttons task.

 

Do you understend the use of both controls "TimeGameOver" & "TimeOut-1Code"?

 

For the rest I don't have problems with the 7segment timer, it indeed starts at 59 but from 59 to 0 that makes 60 seconds 🙂

 

At first I would focus on one thing, led's and push buttons.

Forget about the LCD, delete that code completely and try to make the led's & push buttons working as it should be.

Once that's ok try the LCD stuff in a sepearte VI and once you know it's working implement it in this code. Where did you get that llb?

 

Are you sure the LCD code is correct and that it doesn't interract with your LED's & push buttons? Using the same hardware line twice?

 

0 Kudos
Message 39 of 58
(1,013 Views)

Thanks Alain, I think the timer malfunctioned because of the wait function. 

 

What are the game time over and time out 1 for? I'm not that sure..

 

the LCD is from another DAQ, and its working independently in its own VI which I tried out. it was given to me by one of my seniors.  

0 Kudos
Message 40 of 58
(1,008 Views)