missing high bits of word val


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    17

    Default missing high bits of word val

    what i was hoping to accomplish was to put the counter val into the 17th element of the array of type word.

    but, it is only putting an 8-bit value and not a 16-bit value. i'm missing the high bits.

    i need a small push here to help me get the 16-bit val into an element of the array.

    Code:
    Tst_Array  VAR word[20]
    Counter    VAR word
    
    
    
    FOR counter=0 to 65534
        Tst_Array[17]=counter
        gosub Print2LCD
    NEXT counter

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi there,

    What do you have in "Print2LCD" subroutine? If it is not a light speed transportation project, can you show us?

    Also,

    Why not simplify your code as below?

    Code:
    FOR Tst_Array[17]=0 to 65534
        gosub Print2LCD
    NEXT Tst_Array[17]
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Jan 2009
    Posts
    17


    Did you find this post helpful? Yes | No

    Default

    light speed project, that is funny! ;-)


    it just sends the array to a 2x16 lcd. hmmm, maybe i'm missing a modifier here


    Code:
    Print2LCD
      
        FOR Ndx=0 to 18
           hserout [  Tst_Array[Ndx] ]
        NEXT Ndx
        
    RETURN

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


    Did you find this post helpful? Yes | No

    Default

    I do not have my manual with me but what if you change:
    Tst_Array VAR word[20]
    to
    Tst_Array VAR byte[20]
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    hey mackrackit & others

    i changed type to byte with the same results.

    when array is of type word, and using my debugger i see the element's value as of a word type having 16 bits. so the issue isn't with the array elements. i thinking it is the hserout performing as it is designed to do.

    what i'm seeing is the function hserout, and i assume the software version, serout, is sending values up to dec 255 then rolls back to dec 0 and starts the low bits all over again.

    going to try some things ... back soon ...

    thx

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Tst_Array[Ndx].highbyte, Tst_Array[Ndx].lowbyte ?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2008, 23:19
  4. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 15:23
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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