First Day and need Help!


Results 1 to 18 of 18

Threaded View

  1. #11
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    You can also test the bits in the priority that you want them and jump to the right routine to flip the relay on, then no fancy stuff (masking, tables, lookups, etc).

    like (below is an idea, no idea if it will run) And it will look bad in PBC do to lack of IF ENDIF, but this should get you rolling. Assuming port A and B are PIR0 is RELAY0. Note I do not have the PBC manual with me and just received it and did not start using it do to conditionals, so below is just an idea. Take below and clean it up. Also, do not recall the two commands, the lookup and one other you can index and jump to them. Hope this helps.

    Symbol PortA = 5 'assuming it is 5
    Symbol PortB = 6 'check the ports in the PIC datasheet
    'set PortA and B directions and make sure PortA is in digital mode (some pic need that)

    top:
    peek PortA, B0 'might have these backwards (I am at work no PBC here
    if bit4 = 1 then turnon4 'highest priority camera
    if bit2 = 1 then turnon2 'etc
    goto top

    turnon4:
    poke PortB,%00010000
    goto top

    turnon2:
    poke PortB,%00000100
    goto top
    Last edited by mramos; - 2nd June 2006 at 16:39.

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