LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comparing digital input and output from two different DAQs

The "TimeGameOver" control check if the play time of 1 minute is over.

When the game starts I add 60.000ms to the actual time "Tick count (ms). So that gives me actual time + 60 seconds.

 

The "TimeOut-1Code" control check if the time for 1 code is over, that is the time allowed to push the buttons.

After sending a code to the LED's I add x ms, depending on the game level, to the actual time "Tick count (ms)".

 

Both controls are tested against the actual time in the Time out case.

When the actual time is greather than "TimeOut-1Code" control, the player didn't hit the correct push button so a new code is generated, and a new "TimeOut-1Code" is calculated.

When the actual time is greather than "TimeGameOver" control, the game is stopped.

 

 

I just asked about the LCD since there a lot of hardware is hardcoded in those VI's, so maybe you could have overseen one that causes trouble now.

It would be better to define 3 control lines

-- RS (register select)

-- R/W (read/write)

-- E (enable)

and 1 port for the 8 data lines. Or do you use the LCD in 4 bit mode?

Bundle all those DAQmx tasks in 1 cluster that can be connected to all sub VI's.

So by selecting the hardware in 1 place you have the right I/O in all sub VI's.

That way you can also skip all those create and delete DAQmx tasks in the sub VI's.

0 Kudos
Message 41 of 58
(1,033 Views)
i'm using 8 bit mode for the LCD.. I don't get the part about putting all the sub VIs in a cluster though.. and what do you mean by defining the register select, the read/write and enable lines?
0 Kudos
Message 42 of 58
(1,023 Views)

Not the VI's in a cluster, wonder how you will do that Smiley Very Happy but all the hardware lines for the LCD like in the attached type def & screenshots.

That way the hardware is defined by the MAX and it isn't hard coded in the program.

If at one time an I/O port is broken, just change to another line in the MAX and your code is still working.

 

If you want to do so at lot has to be changed in the LCD llb, so forget it for now and concentrate on making the program working as required. 

You could also put number of lines and characters per line into that type def so that it's usable for all types of HD44780-based LCD's Smiley Happy

Download All
0 Kudos
Message 43 of 58
(1,016 Views)
Ahh I see.. thanks Alain.. I seem to have this problem when running the VI, where the score keeps on increasing by itself.. How do I get about correcting it? I've checked the score part but it seems ok to me
0 Kudos
Message 44 of 58
(1,014 Views)

Flibbertygibbet wrote: 
... ...where the score keeps on increasing by itself.. How do I get about correcting it? 

Do you mean that you don't hit any of the buttons, "data" control keeps value 0, but the score increase by 1 and you get a new code even if "data" isn't equal to "Your code"?

 

Message 45 of 58
(1,004 Views)
yup, its that error. Is there any way to rectify it?
0 Kudos
Message 46 of 58
(999 Views)

Oops!! How did that happen?? Smiley Very Happy !!

Check if you have swapped the cases of the case structure in the "Read from PushButtons" state.

Its not any LabVIEW error, its just a designing issue!

Can you probe the wires coming out of Your Code Property node, Digital Input read, Comparision of Your Code and Digital input in "Read from PushButtons" state. (Right click on the wires and select "Probe" from the shortcut menu).

 

As said by Alain earlier you can bind all the created task in a cluster. Can you also minimize the use of property nodes? actually the manner in which you are using the "Value Property" voilates the data flow paradigm (Not Recomended)!! 

 

"Nice Job Alain!! Kudos"

Message Edited by Krunal K Patel on 07-20-2009 01:39 AM
0 Kudos
Message 47 of 58
(986 Views)

Flibbertygibbet wrote:
yup, its that error. Is there any way to rectify it?

 

To be honest, the code is doing that all the time here on my PC but that's because I don't have physical hardware attached to my computer, only simulated DAQ devices. So with every "Read from PushButtons" the simulated data is increased by one and if by chance the PushButtons data is equal to the randomly selected code, the score increments and a new code is calculated 🙂

Can you put a conditional probe just after the "Equal?" function in the "Read from PushButtons" case. Set the condition to Pause if True. That way the code will stop there only when both "Code" and "data" are equal. Since you don't .........

 

While typing this answer I think I have the reason for this problem! What happen when the randomly selected code is 0????

Right! No buttons pressed is 0, so the code is correct Smiley Very Happy

With the conditional probe you should be able to determine if my assumption is correct!

If yes, modify the code to avoid a 0 code Smiley Indifferent

If no, give us as many information as possible, even screenshots with errors.

Message 48 of 58
(977 Views)

Krunal K Patel wrote:

Can you also minimize the use of property nodes? actually the manner in which you are using the "Value Property" voilates the data flow paradigm (Not Recomended)!! 


What do you mean by that?

I think property nodes are the way to exchange data between states if you don't use a cluster with all this data and a shift register.

 

 


Krunal K Patel wrote:

"Nice Job Alain!! Kudos"


Thanks mate Smiley Very Happy
0 Kudos
Message 49 of 58
(976 Views)
Alain, you were right about the 0 part generating the scores. I've rectified the problem and now the score doesn't increase anymore. THanks! I'm still working on other parts of the program tho.
0 Kudos
Message 50 of 58
(962 Views)