cancel
Showing results for 
Search instead for 
Did you mean: 

ATM Mock Exam

helssoa
Member

Re: ATM Mock Exam

Thanks Jon. Point noted Smiley Happy

helssoa
Member

Re: ATM Mock Exam

Hello John. Comment 2 is invalid. The account data cannot be lost in any circumstance. If you think otherwise, provide a concise sequence of front panel events that would cause the data to be lost. All data from Account info.txt is converted into an array which the design performs a search on upon verification. If the account number does not exist, verification fails and the Search 1D Array Function returns a -1. This -1 flows through the design and is used to write to the array in the "Stop" state but of course the Replace Array Subset (in Data.vi -> "Write" state) will not recognize index -1 and therefore will not replace any part of the array - the array will not be written to. The data array is converted and written back into Account info.txt and will be exactly the same as the data initially read on verification. Please provide your thoughts.
JohnCS
Member

Re: ATM Mock Exam

I do think otherwise:

 

On the very first running of the VI, if you do nothing then this sequence of cases will follow:

Case        User      Index       Data Array    
Initialize    ""           0              Empty
Wait         ""           0              Empty
Timeout    ""           0              Empty
Stop         ""           0              Empty

 

Since the Verify case is not called, the account data is not loaded into Data.vi's uninitialized shift register from the account file. On exit, Data.vi indexes the empty array in the shift register to element 0, replaces element 0 with the empty Account Data, and overwrites previous data in the account file with the empty array.

 

If you have a successful verification on the first running after loading the VI, then the shift register now has the account data and it will act as you say it will. 

 

JohnCS
 

 

helssoa
Member

Re: ATM Mock Exam

Aha I understand. Thanks for the explanation. I have removed the Write functionality in the Stop state and added a separate Write state which is only called when the Return Card & Terminate is pressed. So in a Timeout condition, the data is not over written. Thankyou.
SteveChandler
Trusted Enthusiast

Re: ATM Mock Exam

I just looked again and yes the accounts file does have the data in it. For some reason it was empty before. I had run the program and might have done something to empty it but can not remember how to recreate that.

=====================
LabVIEW 2012