Reading a 8bit Binary word


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Moz,

    Ok, now we have parallel to Parallel with a dinner table as a translator.
    Here is a untested but probably very close working program you are looking for I think...

    Dwayne

    TRISA="11111111" 'set Porta to all input...8 bit
    TRISB="00000000" 'set Portb to all output...8 bit.
    ReadData var byte
    HoldData var byte
    TranslateData var byte
    Counter var byte


    MainLoop:
    ReadData=Porta
    If ReadData!=HoldData then Gosub TableLookup
    HoldData=ReadData
    Goto MainLoop

    TableLookup:
    Counter=0
    Loop2:
    Read Counter,Holddata 'read table
    if Holdata=$FF then Goto MainLoop 'bad data
    If Holddata=ReadData then goto TransmitPortb 'MATCH!!!
    Counter=Counter+2 'Must skip every other byte for table!
    GotoLoop2


    TransmitPortb:
    Read Counter+1, HoldData 'reads Translated value
    Portb=Holddata 'outputs to portb
    Return
    End
    Last edited by Dwayne; - 1st September 2004 at 21:40.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

Similar Threads

  1. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  2. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  3. SEROUT WORD variable problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th April 2009, 11:20
  4. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2008, 23:19
  5. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 15:23

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