First Day and need Help!


Results 1 to 18 of 18

Threaded View

  1. #13
    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.

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