How to send a binary string on an output?


Results 1 to 9 of 9

Threaded View

  1. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Here's a super easy way to do this. Create command tables
    and simply GOSUB to one & output your command bit-stream.

    This looks-up X directly onto PORTB.0, pauses, then gets the
    next bit.
    Code:
    X VAR BYTE
    
    PORTB.0=0 ' set low on boot (change as required here)
    TRISB.0=0 ' RB0 = output
    
    Main:
        GOSUB Command1
        GOTO Main
    
    Command1:
        FOR X = 0 TO 171 ' 172 bits total
        LOOKUP X,[0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,1,_
                  0,1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,_
                  1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,1,0,_
                  1,0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,1,_
                  1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,1,0,1,_
                  0,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0],PORTB.0
         PAUSE 1   ' Note: If this is too long, use PAUSEUS  
        NEXT X
        RETURN
        
        END
    You can have up to 255 entries 'or bits' per table with a 14-bit core device.

    It does eat-up a boat-load of program memory, but it's ultra simple to use.
    Last edited by Bruce; - 25th July 2007 at 23:01. Reason: Changed GOTO Main to RETURN in Command1.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  2. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  5. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04: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