Electronics > Beginners
Assembly code Help! PIC16F57
<< < (26/32) > >>
KL27x:

--- Quote ---And previously KL27x said:
Quote from: KL27x on June 05, 2017, 11:27:50 am
--- End quote ---
Well, thanks Jpanhalt. This guy sounds like a fucking idiot!

but only if you are.
Well, I meant that this would be on you to take some initiate and break some eggs.

Example:

--- Quote ---its this partial pattern2 on a win thing that i think really wrecks this.
--- End quote ---
To you this means something. You're the only one that knows what is supposed to happen. What this pattern2 thing manifests as? No one else even knows. Is it something displays on the 7 segments or the 8 LED thing or what?

If you wanted me to help, you have to describe what is supposed to happen, and what erroneously happens, how often, under what conditions, and you would have to describe it in super particular detail. Doe the pattern2 erroneously happen at the same time as what's normally supposed to happen. Does the regular function get put on hold and continue AFTER this half-pattern2 thing?

See, a video AND a schematic or pinout would perhaps be a good starting point. There's a ton of information that you have but no one else does. So either you need to learn to debug and write assembly, or you need to step up and start gathering and posting this information.


Electrofinn:
OK allow me a little time to put this together and I will report back.
Electrofinn:
Ok, I have here another video, this time from brett, the other dude that was involved in the project. His video illustrates perfectly what "pattern2" is doing.
"pattern2" and "pattern" for that matter are both for the 8 LED's only.

Firstly, a little about "pattern" and then "pattern2"...

0:31 into the video he switches the machine on and after approx 2 seconds "pattern" begins its LED sequence (you managed to sort this out already by getting it to run 32 values instead of 16) this is also the sequence that sometimes doesn't begin until 30-45sec after running out of credits. Its supposed to be approx 2 seconds after, as you can see at 0:58 into the video, it finishes paying out and he runs out of credits, then approx 2 seconds after, returns to its "pattern" sequence. Another interesting observation on my machine is that sometimes it doesn't always begin at the start of the "pattern" table. I took some video footage and slowed it down and managed to conclude that when it does begin in the wrong place, it begins on the 17th value (16th if counting from 0) which is 0DB. but if we never sort this out It wouldn't really bother me but it maybe that this and the next problem are somehow related. Now...

About pattern2...
         
0:50 into the video, watch what happens when he manages to get a win, which in this case he matches the first two reels (I provided a prize breakdown in an earlier post). As soon as the reels stop, it immediately begins it's "pattern2" LED sequence and is accompanied with a beeping sound, you see the LEDs start illuminating from the outside to the inside and from the inside to the outside, it does this twice (which is the complete "Pattern2" loop). Once the sequence is finished, the servo then begins to Payout the money.




As I've previously described, sometimes it does not do the full "pattern2" loop, we already know the complete loop is comprised of 16 hex values, which when converted to their binary equivalents, represents which of the 8 LEDs are lit and which aren't. the problem is that it sometimes will do just 1 frame (one value) of the sixteen, accompanied by 1 beep, or it'll sometimes do more of the loop accompanied by the same amount of beeping before stopping, in either case in does not complete the full loop. Note that the beeping is affected in the exactly the same way as the LED loop. Also note that after this partial loop is finished, the servo begins paying out as normal. An interesting observation is that it seems to be able to do a full loop more times than it fails to do it.


In the attached schematic, the LEDs are connected to RB0-RB7 of the Pic, pin numbers are also illustrated in the schematic. here is the two parts of the magazine article as it was published, which the attached schematic came from. I had to save the attached schematic at a lesser quality for it to allow me to upload but for a better quality version, download the following PDF files. schematic is in part 1.

Part 1

http://www.epemag.wimborne.co.uk/EPE_Fruit_Machine_part_1Dec94.pdf

part 2

http://www.epemag.wimborne.co.uk/EPE_Fruit_Machine_part_2Jan95.pdf
 
Note that I am currently using your last asm, Fruit machine v21 beta.

I think problem for me is that while I find programming interesting and I like to try and learn, I think my interests lay in classical electronics and project building and for me to complete this project in any meaningful amount of time it's obvious to me that I am going to need some help with this. I have tried hard to go away and work on this myself and I'm failing miserably and Not that I wanted to disclose this on here but I suffer with a mood disorder and I'm finding the concentration and patience needed for this a little beyond me, but at the same time I don't want be a failure and I don't want to just give up on this project, I have come so far.
 


         
KL27x:

--- Quote ---Another interesting observation on my machine is that sometimes it doesn't always begin at the start of the "pattern" table. I took some video footage and slowed it down and managed to conclude that when it does begin in the wrong place, it begins on the 17th value (16th if counting from 0) which is 0DB.
--- End quote ---
This is because of bit zero of new_byte. There is no provision in the program to clear this bit. So if you put a coin in while the pattern is in the second half of the pattern, it will remember this the next time pattern starts being called. If this is undesirable, you just have to put a  "bcf new_byte,0" in the program somewhere which won't happen while pattern is being called, like when a coin is detected.

The schematic and the video are going to be useful. When I get some free time I'll add the pinout to the header file and along with the video this will give me some frame of reference.

So it might be awhile, days, maybe weeks. I'm not retired. But the next time I post I suspect I will have either have some answers and/or I'll have some tasks for you to perform using a test code.

In the meantime:
Questions
1. What happens when you put in more than 1 coin? i don't see a display for how many coins you have put in.
    Is there any provision for this? Or are you supposed to only put in 1 coin for each spin? What happens when you drop another before hitting the spin button?

2. What is the maximum win? And do they all produce the same result other than number of servo/coin drops? Run pattern 2 on the LED a few times with the beeping, and then start dropping coins. Then after done, 2 seconds later, back to "state zero" with pattern running on the LEDs and waiting for user to insert a coin?

I imagine the most likely cause of this problem is that he has more than 2 subroutines going at the same time and messing with mode_byte,7 and using the same counter... the one that counts the number of times pattern2 is called before turning itself off. So I imagine the easy fix (if there is one) will be simply using a new register for this counter in the routine that calls pattern2, because we have at least one unused register available.

OR the routine that calls pattern2 is being turned off, prematurely, by something else. Via the pertinent mode_byte bit.

The super long delay that sometimes occurs before pattern comes on after a win/loss.. ... it might be a missed zero check, because some other subroutine has also inc/dec'd a counter, so that counter rolls over while the routine is not looking. But we have to find what is responsible for that delay, and label "timeout" is the obvious suspect, just from memory. If you had time to mess with this to verify, for instance, you could try to make the delay much much shorter by looking at and changing timeout and seeing if that makes the 2 second delay into a split second delay. The highest order counter is the one you would want to mess with... There would be two levels of counter. Again, just from memory. I don't know what counters are used in timeout, and this is just a verification/ruleout.
Electrofinn:

--- Quote ---1. What happens when you put in more than 1 coin? i don't see a display for how many coins you have put in.
    Is there any provision for this? Or are you supposed to only put in 1 coin for each spin? What happens when you drop another before hitting the spin button?
--- End quote ---

Here is another video of bretts that should clear this up even further, its only 1:40 long, but it shows him playing the machine. It looks like his first LED is broken in this vid so ignore that but you see as he puts coins in that the credits are registered and displayed with the same LEDs, even whilst he is playing.

 


--- Quote --- What is the maximum win? And do they all produce the same result other than number of servo/coin drops? Run pattern 2 on the LED a few times with the beeping, and then start dropping coins.
--- End quote ---

Maxiumum win is £1.00 which is all bars "- - -" 20x 5p. he wins a jackpot in the video. The LED sequence and beeping is the same for all wins and yes it then starts dropping coins after the sequence.



--- Quote ---Then after done, 2 seconds later, back to "state zero" with pattern running on the LEDs and waiting for user to insert a coin?
--- End quote ---


Yes that is correct.


   
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod