8 Byte string


Closed Thread
Results 1 to 2 of 2

Thread: 8 Byte string

  1. #1
    Join Date
    Jul 2005
    Posts
    18

    Post 8 Byte string

    The PB manual states that PB does not provide string capabilities with the exception of some commands.

    What I'm trying to do is to declare an 8 byte string such as

    $1E1E0C0C0C6C7C38

    Then I would like to extract the 1st byte, send it to a device. Then extract the second byte and send it to another device and so on. At the moment I'm achieving this by doing:

    for device = 1 to 8
    gosub getbyteval
    ShiftOut DOUt,clk,MSBFIRST,[device\8,ByteVal\8]
    next

    getByteVal: ' selects byte value according to device value
    SELECT CASE device
    CASE 1,2
    byteval = $1E
    CASE 3,4,5
    byteval = $0C
    CASE 6
    byteval = $6C
    CASE 7
    byteval = $7C
    CASE 8
    byteval = $38
    END SELECT
    return

    This works but the problem is that I have as many as 200 of these getByteVal subroutines to write. Is there a way to do this in less lines.
    Maybe declare a string and extract its contents in the same line?

    I've done ASM before. I seem to recall you could do some thing like this:

    MOV DPTR,#FROMBLK

    getByteVal: DB 1EH,1EH,0CH,0CH,0CH,6CH,7CH,38H


    But Im rusty at it and need to brush up on it, I know there a few lines missing. If anyone can give me any pointers, it will be appreciated.

    Juan

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


    Did you find this post helpful? Yes | No

    Default

    Regards,

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

Similar Threads

  1. LCD freeze
    By harryweb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th October 2009, 08:01
  2. Memory use - how much do you use?
    By keymuu in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 10th June 2009, 22:39
  3. byte compression
    By Norbert in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th June 2007, 18:04
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. 16F877 RAM Question
    By Art in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 6th August 2005, 11:47

Members who have read this thread : 1

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