07-18-2009 11:35 AM
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.
07-19-2009 12:19 AM
07-19-2009 07:28 AM
Not the VI's in a cluster, wonder how you will do that 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
07-19-2009 07:46 AM
07-19-2009 10:43 AM
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"?
07-19-2009 11:44 AM
07-20-2009 01:30 AM - edited 07-20-2009 01:39 AM
Oops!! How did that happen?? !!
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"
07-20-2009 05:59 AM
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
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
If no, give us as many information as possible, even screenshots with errors.
07-20-2009 06:04 AM
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.
Thanks mate
Krunal K Patel wrote:"Nice Job Alain!! Kudos"
07-20-2009 09:02 AM