Reaction timer using 16f877a and pbp


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2007
    Location
    england
    Posts
    15

    Cool Reaction timer using 16f877a and pbp

    i am building a project that consists of two buttons connected to a pic 16f877a that needs to have a time delay and at the end of the delay a light comes on and the button has to be pressed, the first to press their button is the winner and their led lights for 30 seconds and then goes off but the time delay needs to be a random time between 2 and 10 seconds each time the game is played. (ie not the same time delay every time) could anyone help with this problem as i have been searching through the forums but am unable to find any code for pbp that can help. i have built the circuit and can place the led's and buttons on any port. it would also be very useful if it was possible to display on a couple of 7 seg displays the time between the light coming on and the button being pressed. i will post all details of the project as soon as its completed. many thanks in advance for all/any help.
    Last edited by sphinxifm; - 14th July 2007 at 13:46.

  2. #2
    Join Date
    Jun 2007
    Location
    england
    Posts
    15


    Did you find this post helpful? Yes | No

    Cool Perhaps this will help?

    Power On

    Turn on power led (PORTA.0)

    Play “WELCOME” Message (PORTB.1)

    Turn On Ready led (PORTA.1)

    Wait for START button (PORTB.0)

    Turn Off ready led (PORTA.1)

    Play game “START” message (PORTB.2)

    Turn On game active led (PORTA.3)
    Turn On Green led (PORTA.4)
    Run random timer sequence

    Play “FIRE” message (PORTB.3)
    Turn off green led (PORTA.4)
    Turn on Red led (PORTA.5)

    Read input from p1 (PORTC.1)
    Read input from p2 (PORTC.2)

    On interrupt from p1 or p2 (PORTC.1 & PORTC.2)
    Play “BANG” (PORTB.4)

    If p1 Turn on P1 led (PORTC3)
    Play “PLAYER 1 WINS” (PORTB.5)

    If p2 Turn on P2 led (PORTC4)
    Play “PLAYER 2 WINS” (PORTB.6)

    Wait 30 seconds
    Turn off p1 and p2 led (PORTC3 & PORTC4)

    Goto Wait for Start Button

  3. #3
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    Why not start with something like this:

    http://www.radioshack.com/sm-whats-a...i-2117994.html

    It will teach you basics of microcontrollers, so you can learn to write your own programs. It even includes a "reaction timer" example. Or get a beginners book on PIC BASIC, which will also have examples to get you going in the right direction.

    I think many people here could write that program for you in about 20 minutes, but then what have YOU learned? If you do it yourself you will also be much more qualified to document the project. If you understand just a FEW basic commands, then this should be a very easy project.

    If you run into problems, then this forum is a great place to get help. But you need to at least TRY. Not just ask for some pre-written code.
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  4. #4
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    OK, by the time I posted, you had already sent a second post.

    Your first post is an "idea".

    Your second post is an "outline", not quite a flowchart or pseudocode though.

    So what's the problem?? Convert what you have into actual code. Get each part working, then put it together.

    Are you just looking for encouragement??

    "Go do it! What are you afraid of? You can't break the PIC by trying! You don't even have a question yet. Staring at that circuit won't make it work, DO SOMETHING!"

    Sorry, military training flashback
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

Similar Threads

  1. Darrel Taylor - Instant Interrupts-Problem 16F877A
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st December 2009, 13:19
  2. 16F877A Microcode Studio won't compile
    By curt66111 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th November 2009, 19:35
  3. PBP 2.50 UPGRADE problems!!!!
    By earltyso in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 7th March 2008, 15:42
  4. EEROM problems in 16F877A
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st May 2007, 02:52
  5. Read the newbee threads, 16F877A no go.
    By BobbyA in forum mel PIC BASIC Pro
    Replies: 39
    Last Post: - 31st December 2006, 03:09

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts