First Day and need Help!


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    timmoore47's Avatar
    timmoore47 Guest


    Did you find this post helpful? Yes | No

    Default

    Many thanks for that I'll take a very close look at it.

    Should watchdog fuse be ticked or not at time of flashing?

    Whilst I don't understand bits of it, I've been messing about and freely adapted a chunk of code posted by Lauren Barta

    Code:-

    Symbol TRISB = 134 'Symbol For TrisB Is Decimal 134
    Symbol TRISA = 133 'Symbol For TrisA Is Decimal 133
    Symbol PORTB = 6 'Symbol For PortB Is Decimal 6
    Symbol PORTA = 5 'Symbol For PortA Is Decimal 5


    Poke 134, 0 'Makes All PortB Pins Outputs
    Poke 133, 255 'Makes All PortA Pins Inputs

    Start:

    Poke 6, 0 'Makes PortB Pins Low
    Pause 10 'Short Pause

    Run:
    LET B2 = 0 'Making B2 a zero
    Pause 10 'Short Pause
    Peek PortA, B0 'Look at PortB, put results in B0

    Filters:
    IF B0 = 3 THEN Run1 'start of 24 filters, 23 yet to be added
    poke 6, B0
    Pause 7500 'Wait 3 seconds
    goto Run 'Start all over again!

    Run1:
    B0 = 5
    poke 6, B0
    Pause 7500 'Wait 3 seconds 10 Mhz clock
    goto Run 'Start all over again!

    End
    Last edited by timmoore47; - 2nd June 2006 at 19:29.

  2. #2
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    This is what I meant when I mail the last post from work. Use a couple of your lines.
    Code:
    Symbol TrisB = 134 
    Symbol TrisA = 133 
    Symbol PortB = 6 
    Symbol PortA = 5 
    
    Poke TrisB, 0      'Makes All PortB Pins Outputs
    Poke TrisA, 255   'Makes All PortA Pins Inputs
    
    Poke PortB, 0      'Makes PortB Pins Low
    
    'depending on PIC type, make sure PortA is set for Digital IO
    
    top:
    pause 7500
    peek PortA, B0           'read PIRs or sensors
    
    'check the sensor bits
    if bit4 = 1 then turnon4 'highest priority camera
    if bit2 = 1 then turnon2 'etc
    if bit1 = 1 then turnon1 'etc
    if bit3 = 1 then turnon3 'etc
    if bit5 = 1 then turnon5 'etc
    if bit0 = 1 then turnon0 'etc
    
    goto top
    
    turnon0:
    poke PortB,%00000001
               '76543210    'The relay to turn on is 0
    goto top
    
    turnon1:
    poke PortB,%00000010
               '76543210    'The relay to turn on is 1
    goto top
    
    turnon2:
    poke PortB,%00000100
               '76543210    'The relay to turn on is 2
    goto top
    
    turnon3:
    poke PortB,%00001000
               '76543210    'The relay to turn on is 3
    goto top
    
    turnon4:
    poke PortB,%00010000
               '76543210    'The relay to turn on is 4
    goto top
    
    turnon5:
    poke PortB,%00100000
               '76543210    'The relay to turn on is 5
    goto top
    Last edited by mramos; - 3rd June 2006 at 00:31.

  3. #3
    timmoore47's Avatar
    timmoore47 Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Paul & MrAmos,

    Thank you both so much for your substantial samples of code. Because of them I was able to complete and test the code using a test jig of a bunch of switches and led's for driving the video switch and pir inputs.

    FANTASTIC! IT WORKED AOK!

    I've got to finish off the PIR Inputs circuits and the video switch circuits but the hardware is easy compared to driving the PICs.

    I've avoided assembler which would have slowed the project down loads.

    The Hedgehog (European Wild variety) breeding season is upon us and in a about 3 weeks we hope to be able to track and record movement of the hoglets. We hope somewhere between 3 and 9 will arrive in the end of June batch and similar numbers in September and October.

    Curently we track 13 adult hedgehogs manually up to about 3am most nights and are VERY keen automate it. Since January we have filled 136 DVD's full of data burnt out two DVD Recorders and now use a Pioneer 80GB Recorder *LOL*.
    Many thanks again!



    Tim

  4. #4
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Tim,

    Post a picture to this thread of a hoglet camptured by PBC code - everyone would enjoy that (unless they do not like hedgehogs). We do not have hedgehogs here in Utah as far as I know.

    As a side note, you might want to check out this guy's stuff - awesome homebrew PIR camera stuff. I have made some of these camera modifications and they work quit well.

    http://www.jesseshunting.com/forums/...p?showforum=50

    As always
    Good Luck,

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  5. #5
    timmoore47's Avatar
    timmoore47 Guest


    Did you find this post helpful? Yes | No

    Default

    Many thanks Paul, I'll do that. Meanwhile here is a link to a video we made of a Hedgehog plus some other wild and not so wild life. The last few minutes is the best.

    Totally tame for non wild-life folk, BTW>



    Tim

    link:-

    http://video.google.com/videoplay?do...72146235684890

  6. #6
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    Tim:

    Good stuff. My kids loved it (3 boys).. We used to, a few years ago, I would put a PIR an a long cat 5 wire in the yard, and a battery and buzzer at the other end. When a raccoon would come up (I would leave sardines in front of the PIR) go on the balcony and watch them eat. They loved it..

    It was funny, you hear the buzzer, and kids running up the stairs.. It reminded me of those days.

    It us know if you have any questions. Or hardware issues to resolve.

  7. #7
    timmoore47's Avatar
    timmoore47 Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks MrAmos! Your Racoons sound fun!

    Hardware should be OK but I'll keep in touch as to the progress!



    Tim

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