two bytes


Closed Thread
Results 1 to 4 of 4

Thread: two bytes

  1. #1
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153

    Default two bytes

    Below I have code where I get serin2 v3.byte1, I must echo back serout2 v3.byte1 to get serin2 v3.byte0, now when I lcdout v3.byte1 I get 8 and when I lcdout byte0 I get C both of these are correct and it works great now when I lcdout v3 I get 80C I have tried to shift this out, it changes the value I cannot shift out the upper or lower byte why am I getting the 0 in v3 output. this value is needed in another part of the program and I can lcdout hex1 v3.byte1,hex1 v3.byte0 and make it look correct but I need to compare this value somewhere else.




    SERIN2 PORTB.1,16468,100,key,[HEX1 V3.byte1] 'GET BYTE 1 DATA
    SEROUT2 PORTB.2,16468,[HEX1 V3.byte1] 'SEND BACK BYTE 1 ECHO
    SERIN2 PORTB.1,16468,100,key,[HEX1 V3.byte0] 'GET BYTE 2 DATA

    lcd: LCDOUT $FE,$94,hex V3.byte1
    LCDOUT $FE,$D4,hex V3.byte0," ",hex V3

  2. #2
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Re: two bytes

    I think its solved shifted lower byte left 4 then whole word right 4

  3. #3
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: two bytes

    why am I getting the 0 in v3 output
    You might have figured it out already, but 0C is the correct value when displayed as a WORD or 16 bit value.
    8 by itself is 8 in a Byte
    C by itself is C in a Byte
    But as a Word, 8C is only 140 not 2060 like 80C.

    The leading 0 is not displayed for 080C.
    Louie

  4. #4
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Re: two bytes

    Thanks LinkMtech
    After messing with it for the weekend I kinda? thought that, its good to know now for sure.
    anybody know of a better way of doing this or is what I have after shifting fine.

Similar Threads

  1. HSERIN 5 bytes from PC
    By Pic2008 in forum Serial
    Replies: 3
    Last Post: - 24th January 2009, 03:12
  2. negative HEX to bytes
    By cpayne in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th October 2008, 18:50
  3. Bits & Bytes
    By electronicsuk in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th April 2006, 11:52
  4. eeprom 40 bytes
    By mike12 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd January 2006, 14:28
  5. Converting Bytes from hex to Dec
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th April 2005, 19:44

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