Electronics > Beginners
Assembly code Help! PIC16F57
(1/32) > >>
Electrofinn:
Before I start with what I need help with I feel a little back story will help. I am working on a fruit machine (Slot machine) project that was originally published in the EPE electronics magazine in two parts on December 1994 and January 1995 (a UK electronics magazine) The original project used a PIC16C57 and you had to order this pre-programmed at the time, more on this later. The project also utilised three, seven segment displays which are the reels of the fruit machine.
 
In 2012 I showed an interest in resurrecting and rebuilding the project as the first attempt was a messy one! So I had reached out to the magazines forum and to my amazement the original creator of this project had surfaced and was extremely helpful, he and his collaborative partner of the project kindly decided to open source the code and helped me find the now newer equivalent to the PIC16C57 which is the PIC16F57. With his help I was successful in programming the updated chip with no modification to the code (although it did list some warnings but worked anyway) However there were some differences from original program, for instance the LED demo sequence which Is displayed a couple of seconds after switch on, and is displayed until player inserts a credit, was different from the original. I informed the creator of this and concluded the code was a different version than that supplied on the PIC all those years ago. Unfortunately the creator couldn't find this newer version and the original PIC was code protected and couldn't be copied, but he was very helpful in telling me the parts of the code I could change to manipulate the sequence amongst other things. There was also another difference but more on this in a moment.

At the time I had some life issues going on and had to push the project to one side, I had stopped conversing with the creator and lost contact. Its only recently I have decided to pickit! Back up again and get this thing finished. There are things I am still trying to achieve with it but attempts to contact him for further help have failed. Though to be fair, even at the time of talking to him he had sort of moved on from it, I was extremely fortunate and grateful that he helped me as much as he did. He currently operates a fairly successful YouTube channel and in fact has posted a video about the fruit machine project with links to the original magazine article and source code, however he hasn't responded to my questions, and to be fair it was posted 4 years ago and other attempts to contact him are probably lost in a sea of other messages he now probably receives and has no time or even maybe no interest in responding, but I am understanding of that.

Link to the YouTube vid, the pdf article and source code files are in the vid's description... https://www.youtube.com/watch?v=GCGmK0gCCUI

There are two things I need help with, the first thing is still regarding the LED sequence. Now my assembly knowledge is extremely limited and need help with getting this to work. The LED sequence works by calling a lookup table named “pattern” using addwf and retlw, the original chip seems to display 32 different LED patterns/combinations and then loops around again, the source code version displays 16, however when I try to add more than 16 hex values to the table, they don't get used, it just loops 16 of them. Obviously as I can’t read the original chip and so I can’t see how he did it. There is a second table named “pattern2” this is the sequence displayed when a player has a win, this is the same as the original and I’m happy with that.

The second problem is that on the open sourced version, when you first switch the machine on and put the first credit in, it often gives the player the option to hold all the reels straight of the bat and because the reels are always on bars on the first switch on it gives the player an instant jackpot win! The original chip does not do this and the creator of the project had obviously fixed this in the final version, I don't possess the knowledge to fix this. If someone could please advise me or look at the source code on the YouTube vid, I would so appreciate it. Thank you in advance everybody.
jpanhalt:
You will have to post your code for anyone to help.
Electrofinn:
OK have attached code, Only changes I made are the list pic value from p=16C57 to p=16f57. added config bits, and I added a bunch of 0FF hex values to the "pattern" table for testing which should keep LEDS on solid but as previously stated only the first 16 I added actually work which is like a chasing/twinkle pattern.     
Zero999:
Here's a tutorial on how to program in assembly for baseline PIC processors. I followed it myself a few years ago and managed to write a simple program within a day. The PIC16F57 has the same core as the ones described on the tutorial linked below, so it's a good fit.
https://www.gooligum.com.au/PIC-tutorials/baseline-PIC-tutorial
Electrofinn:
Thank you so much for that, will try and give it a go but don't think I have a head for this, might end up  |O lol. And I can't think of an instant after this when I would use it again and therefore will probably forget it before long. will give me something to watch at bed time tonight though. you never know it might stick. thanks   
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod