Truth Tables in PBP


Results 1 to 19 of 19

Threaded View

  1. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Truth Tables in PBP

    If you need fast response you can create tables using arrays.
    For 4 bit system you have 16 different states, so you create array which hold data for output for every 16 states. And use 4 bits of ports for inputs, and outpust, eg portb0 to Portb3 is inputs, portA0 to 3 are outputs.
    TruthTable var byte[16] BANKA'So pbp doesn't need to put banksel after each command
    TruthTable[0]=%00001111
    TruthTable[1]=%00001100
    etc...
    TruthTable[15]=%00001111
    TRIS...
    ANSEL
    ETC..
    Tmp Var byte BANKA
    Main:
    Tmp=portb & %00001111
    porta=TruthTable[Tmp]
    goto Main
    This will give almost fastest response for given clock speed.
    If you grounded upper nibble, this give you fastest possible responese
    Main:
    porta=TruthTable[portb]
    goto Main
    If speed isn't critical you can assign bits to Tmp variable from any pin...
    Last edited by pedja089; - 30th August 2014 at 10:41.

Similar Threads

  1. tables using PBP and asm command retlw
    By queenidog in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th June 2012, 23:47
  2. Help with two lookup tables?
    By awdgsx in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th February 2012, 10:13
  3. Help with look up tables please
    By opticaltrigger in forum mel PIC BASIC
    Replies: 3
    Last Post: - 19th June 2010, 02:54
  4. Re:The Truth about Chernobyl Via Melanie
    By emmett brown in forum Off Topic
    Replies: 1
    Last Post: - 15th August 2006, 09:25
  5. Truth Tables
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th April 2005, 18:35

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