What am I doing wrong?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    OK, now I think I see what you are doing. Me a little slower than normal today...

    Code:
    row = PORTB & %00001110
    Should isolate bit 1 ,2, and 3.
    Dave
    Always wear safety glasses while programming.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Well I tried that also, but that doesn't work either. I believe I mentioned earlier that I in my mind I was thinking since I moved the rows and columns over by one bit why don't I just create another variable such as:

    row1 = row >> 1

    then I could still use the same formula:

    key = (row * 3) + (NCD (col ^ $f)) ' (row * 3) because I have three rows and when I return the priority bit
    'of the columns after I flip the state of the bits ^$f that will tell me which
    ' column is actually the one being used at that moment of time as an output.

    But I tried it and still have not gained any ground.

    hmmm, back to the drawing board.

    Thanks again...

  3. #3


    Did you find this post helpful? Yes | No

    Default Update

    If I substitute this:

    if row = 1 && col.0 = 0 then key1 = 1
    if row = 1 && col.1 = 0 then key1 = 2
    if row = 1 && col.2 = 0 then key1 = 6
    if row = 1 && col.3 = 0 then key1 = 7
    if row = 2 && col.0 = 0 then key1 = 5
    if row = 2 && col.2 = 0 then key1 = 10
    if row = 2 && col.3 = 0 then key1 = 11
    if row = 3 && col.0 = 0 then key1 = 3
    if row = 3 && col.1 = 0 then key1 = 4
    if row = 3 && col.2 = 0 then key1 = 8
    if row = 3 && col.3 = 0 then key1 = 9

    for this:
    key = (row1 * 3) + (NCD (col ^ $f))

    everything works great but isn't there a simpler way?

    Thanks

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