Word array behaving like byte array.... wierd


Results 1 to 15 of 15

Threaded View

  1. #1
    forgie's Avatar
    forgie Guest

    Question Word array behaving like byte array.... wierd

    Hi there,
    I have a piece of code which looks like thus:
    <code>
    Sample_Buffer[Sample_Index] = ADC_Buffer
    </code>


    All of these variables are declared as variables. When I check the data, Sample_Buffer[Sample_Index] is always less then 256, although I know that the data in ADC_Buffer is often higher then this.

    I have tested it by changing the code to this:

    <code>
    if ADC_Buffer > 255 then
    lcdout cmd, cls, "BIG NUM"
    endif
    sample_buffer[sample_index] = adc_buffer
    </code>

    And sure, enough, "BIG NUM" is spat out on the LCD. If I use the same check for the Array Variable after copying the data into the array, it always comes back as being < 256.

    Where is the other half of my word going??? Has anyone else seen similar behaviour? Am I doing something really stupid?

    EDIT: This is on an 18f452, using PBP 2.43
    Last edited by forgie; - 31st July 2005 at 15:33.

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. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2008, 23:19
  3. byte compression
    By Norbert in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th June 2007, 18:04
  4. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 15:23
  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