Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16F84 Dice Game

Status
Not open for further replies.
Forget my previous post. I have found the problem. counta should be countA. Just changed letters to upper case & that solved the problem of building the file. I will now try it to see if it works.
 
Dice game

Well now we are making progress. The leds are flashing and coming to a stop giving different numbers when stopped. However there are still a couple of problems.
1 When I first apply power to the circuit the leds light up. My understanding is that they should not light up until the button is pushed.
2 When the roll is finished, the system should shut down after 50 seconds or so.

With my very limited experience with coding I will fool with the coding a bit to see what I can come up with. As always I will still be open for suggestions.
 
1 When I first apply power to the circuit the leds light up. My understanding is that they should not light up until the button is pushed.
2 When the roll is finished, the system should shut down after 50 seconds or so.

1) According to the listing it should call 'LEDTEST' and display the various combinations (which it does) then 'sleep'.
2) We commented out 'Sleep' to see what was going on.

Now that we have 'got it going' we can now put 'sleep' back in.
Though you will have to play around with the timings. I have allowed a long 'final' display before sleep, but it doesn't seem very long to me.

Try this;
 

Attachments

  • Dicegame_test2.asm
    12.1 KB · Views: 177
counta should be countA. Just changed letters to upper case & that solved the problem

That could be because you have 'case sensitive' ticked in MPASM.
 

Attachments

  • Mpasm.jpg
    Mpasm.jpg
    62.9 KB · Views: 198
OK HouseOFwax here are the latest results of what we have accomplished. The dice game is now working almost perfectly. I have increased the delay time in the display section by replacing the movlw and call d_0 with call Delay255. I used the call Delay 255 six times and this allows the leds to go to sleep after a short period. I am sure there must be a more efficient way of doing this but I will have to read up and find out how. There is one slight problem though. Sometimes lets say for example #4 lights up. The leds are not necessarily in the 4 corners as they are in real dice. I am thinking this could have something to do with the internal timing. not a big deal though.

Now I will start to build the container and assemble the project. I would just like to take a moment to thank you again for your patience with me and taking the time to help me out.
 
I suspect that the delay problems are due to the fact that we are using internal oscillation rather than the resistor / capacitor arrangement (big difference).
I don't think that the "The leds are not necessarily in the 4 corners as they are in real dice", is due to timing*.
That is probably an arrangement of your particular set up of the LEDs (not entirely sure).*

I'll have a look tomorrow and see what else we can sort out.
"version 8.4". That I don't know, I tried to see what that version looks like, but in the time available, I didn't get there.

As for taking the time to help, I'm enjoying the challenge, glad to help. :)

*just back from the pub.
 
HouseOFwax, Found the problem. Now everything is working just as it should. Further checking of the code revealed that I had some of the pin connections wired wrong. When I first connected the leds I was not sure just exactly which pair of leds went to which pin. After studying the code under the hardware constants I realized my mistake. I also fooled with the code a bit to extend the display time and the roll time. This has been a great learning experience for me, but I still have an awful lot to learn.
 
Dice game

Here are the attachments
 

Attachments

  • image5.gif
    image5.gif
    33.5 KB · Views: 226
  • image1.gif
    image1.gif
    3.4 KB · Views: 201
  • Dicegame_test3.asm
    12.6 KB · Views: 174
Status
Not open for further replies.

Latest threads

Back
Top