Byte from variable


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2015
    Posts
    9

    Default Byte from variable

    Hi everybody.
    I do have a small issue..
    I try to extract a bit from a byte, but it wont work. Can anyone explain how to do, and what im doing wrong.
    I have searched the forum and google, but just cant find a answer.


    Codesnippet:

    tmp=%01011111

    For I=0 to 7

    sr_data=tmp.I ' It doesnt work with I here, I have to use a real number like 0-7

    sr_clock=1
    sr_clock=0

    next I

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default Re: Byte from variable

    Code:
    tmp=%01011111
    
    For I=0 to 7
    
    sr_data=tmp.0[I] ' It should work with I here,
    sr_clock=1
    sr_clock=0
    
    next I
    manual $ 7.6.5 ...
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jan 2015
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: Byte from variable

    Perfect. Its work, and I also read the chapter in the manual. Couldnt find it before. So I know WHY it works.
    Thanks a lot, now I can continue on my project.

Similar Threads

  1. Help: how to assign assorted pins to one byte variable
    By Heckler in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th March 2011, 00:38
  2. Checking Bit of a Byte using another variable
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th December 2010, 16:02
  3. Byte Variable modifiers
    By bugmee in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th March 2010, 17:27
  4. Structure of a Byte Variable
    By Archangel in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th July 2008, 09:33
  5. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 22:16

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