BaseBall pitching Code sample - NewBie


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7

    Default BaseBall pitching Code sample - NewBie

    Newbie here. I have an idea of a backboard that a baseball pitcher can throw at and it will display strikes, outs and balls... with two switches.
    Being my first time trying this can you all take a look or better yet try it on a test board ? I do not have my parts ordered yet and would like to get a idea of what I'm needing.. I have based the code on a 16f684 chip.

    Include is baseball.zip
    Attached Files Attached Files

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by foxstar View Post
    Newbie here. I have an idea of a backboard that a baseball pitcher can throw at and it will display strikes, outs and balls... with two switches.
    Being my first time trying this can you all take a look or better yet try it on a test board ? I do not have my parts ordered yet and would like to get a idea of what I'm needing.. I have based the code on a 16f684 chip.

    Include is baseball.zip
    My question is...how are you going to do all of the sensing in and out of the strike zone? Pressure switches, light beams?

  3. #3
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Think of a 4 by 6 foot tic-tac-toe board. the center plate is the strike zone, all the outer plates are the balls zones. Each plate floats on springs and when hit, pushes on a switch. after 3 strikes, it goes to 1 out.. after 3 outs all leds are cleared, after 4 balls all leds are cleared.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by foxstar View Post
    Think of a 4 by 6 foot tic-tac-toe board. the center plate is the strike zone, all the outer plates are the balls zones. Each plate floats on springs and when hit, pushes on a switch. after 3 strikes, it goes to 1 out.. after 3 outs all leds are cleared, after 4 balls all leds are cleared.
    That sounds reasonable. I'd put multiple switches in each box, one in each corner, one in the center, 5 per box I suppose...easy enough. What happens if you get 2 boxes (or 3 or even 4 in certain cases) with one pitch?

  5. #5
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    At this level, I just have two inputs, all ball hits are tie to one lead and the strike zone is lead #2. in the code I test for strikes first then balls. So strikes win in most cases. the layout is very basic. I'm looking for help on the circuit layout. Something very basic, just to prove it works.

  6. #6
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    I have tried to test this code and I can not get either of the switches RA.3 or RC.3 to fire off. Dose anyone know why? Are the registers set correctly?

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by foxstar View Post
    I have tried to test this code and I can not get either of the switches RA.3 or RC.3 to fire off. Dose anyone know why? Are the registers set correctly?
    Put a meter on the pins to make sure they're actually changing states?
    Registers appear to be set correctly, that is if you are using the same code you posted in the zip file earlier.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The Inning isn't over just because you Walk somebody.

    If balls = 4 Then over

    <hr>
    Do you have pull-up resistors on RA.3 and RC.3 ?
    Is the PIC even running? Can you Blink an LED ?
    <br>
    DT

  9. #9
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Chip Layout - help

    OK, folks I include a layout of the chip and what I'm trying to do.
    I used the paint program, It's all I have to draw with..

    Again it's a PIC16F684 e/p

    Thanks!
    Attached Images Attached Images  

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by foxstar View Post
    OK, folks I include a layout of the chip and what I'm trying to do.
    I used the paint program, It's all I have to draw with..

    Again it's a PIC16F684 e/p

    Thanks!
    Have you configured MCLR as internal in your code?
    Are you sure you have the A/D pins set up correctly for digital?

    Also, I'm not so sure that:

    sled var porta
    oled var portc

    will work the way you want it to.
    Last edited by skimask; - 8th May 2007 at 04:58.

  11. #11
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by foxstar View Post
    I used the paint program, It's all I have to draw with..
    Here are a couple of options, some are freeware, others offer free versions with reduced capabilities/personal use only.


    CADSoft Eagle PCB software
    The Lite version is freeware for personal use. Size limited to 100 x 80mm or 4 x 3.2 inches. Autorouting, does schematic layout and PCB patterns. Price starts at $99.
    http://www.cadsoftusa.com/

    DipTrace
    Easy to use Schematic / PCB program
    http://www.DipTrace.com

    FreePCB
    An open source layout program, imports PADSPCB format. Stable and usable, but still very basic. Ver 1.01, Windows only at this time.
    http://www.freepcb.com

    KiCAD
    GPL'd Schematic Capture, PCB's up to 16 copper layers and no board size limits, Gerber viewer, Yahoo group
    http://www.lis.inpg.fr/realise_au_lis/kicad/

    Target 3001
    PCB, schematic, simulation CAD, CAE. Several versions from free to hundreds of Euros, based on limitations. German, French, and English.
    http://www.ibfriedrich.com/

    HTH,
    SteveB

  12. #12
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Have you configured MCLR as internal in your code?
    Are you sure you have the A/D pins set up correctly for digital?

    Also, I'm not so sure that:

    sled var porta
    oled var portc

    will work the way you want it to.
    TRISA = %00110111
    TRISC = %00110111 should set the Pins for digital

    I'll remove sled and oled and replace with porta, portc

    You are talking about the "CONFIG: CONFIGURATION WORD REGISTER"
    bit 5 - 0 = RA3/MCLR pin function is digital input. Right?

    Now that I need to set the CONFIG REGSTER, any help with the other 15 bits?

  13. #13
    Join Date
    Apr 2007
    Location
    KC MO
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Thanks SteveB, I look into these. Great Help guys!

Similar Threads

  1. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. MN1307 sample code problem
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 20th November 2008, 20:41
  5. 18F8722 sample code
    By George in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th June 2008, 13:42

Members who have read this thread : 1

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