Bits, Bytes Words and Arrays


+ Reply to Thread
Results 1 to 25 of 25

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mtripoli View Post
    I'm not "new" here; I just don't get into every little thing that's posted.

    Data sheets and manuals are not written "by engineers for engineers"; that's nonsense. They are written for those knowledgeable in the discipline. If you have not taken the time to make yourself knowledgeable then it's on you. If you don't understand the information in the manual then get a basic book on electronics and educate yourself. There is nothing in the manual that anyone with a basic understanding of electronics wouldn't understand.

    Contrary to what (it appears) many people on this forum think, electronics and microcontroller programming isn't some "plug 'n play" hobby. It requires a great deal of time to gain the knowledge to succeed. Yes, I am knowledgeable in the field. This didn't happen by accident; I've spent a great deal of time reading books, manuals and data sheets. I began with the fundamentals and worked up from there. Once you spend the time you'll begin to see that the "unusual new ideas" are neither "unusual" or "new" and are in fact rubbish from people that haven't spent the time up front to know what they are talking about.

    I feel so sorry for tech support guys; I really do.

    Mike Tripoli

    P.S. Your little "quote" about Communism is complete crap.
    OOOO!!!!!!
    An attitude!!!

    This forum is about helping people. Maybe you have never needed help in understanding or have never ask a question???

    Yes, there are many who come here looking for a copy/paste solution. They get "weeded".
    There are many who do not have the years behind them to have learned.
    There are many that come from another language or discipline also. Are they to be ridiculed?

    IF
    you think the people truly trying to learn are beneath you
    THEN
    BUZZ OFF!!!!
    ELSE
    never mind
    just
    BUZZ OFF...
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,
    Opinions are what makes for horse races. Everyone starts out as a newbie, and people learn at different rates. Those are Facts, added to my opinion above. You have a great day! I choose not to argue.
    JS
    Edit: Melanie did this forum a service with this and nearly all of her posts, I say nearly, because Nobody is ever always or never.
    Last edited by Archangel; - 2nd February 2010 at 01:07.
    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.

  3. #3
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Bits, Bytes Words and Arrays

    This is working in Pic Basic:

    For MyVar=0 to 15
    MyBit=MyWord.0(MyVar)
    LCDOut $FE,1,"Bit ",#MyVar,"=",MyBit
    Pause 2000
    Next MyVar

    But I can not get to work in Pic Basic Pro

    I need to read/write some bits from/to a word variable and this method was very useful.

    Any ideas?

    Many thanks,

    Ricard.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,622


    Did you find this post helpful? Yes | No

    Default Re: Bits, Bytes Words and Arrays

    Hi,
    It works perfectly fine here. I had to add a # in the LCDOUT statementin order to have it actually display "1" or "0" but apart from that it works as I'd exect it to.
    Code:
    MyVAR VAR BYTE
    MyWord VAR WORD
    MyBIT VAR BIT
     
    MyWORD = %1010101010101010
     
    For MyVar = 0 to 15
      MyBit = MyWord.0(MyVar)
      LCDOut $FE, 1, "Bit " ,#MyVar, "=", #MyBit
      Pause 2000
    Next MyVar
    /Henrik.

  5. #5
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Bits, Bytes Words and Arrays

    Henrik,

    Thanks for your help. I not tried exaktly this (i have no LCD)

    I tried this:

    MR var word: H var byte

    for H=0 to 15
    MR.0[H]=1 'set bit H of MR
    next H

    This works fine in PicBasic but when compiling in PicBasicPro this bits never are set. Other things in my code (about 8k) works perfect. I have only problems when adressing bits form words or bytes

    Maybe I have a library instalation problem?

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,622


    Did you find this post helpful? Yes | No

    Default Re: Bits, Bytes Words and Arrays

    Hi,
    That is weird.... This code:
    Code:
    MR var word: H var byte
     
    MR = 0
    HSEROUT ["First, all zeros:",13]
    HSEROUT ["MR = ", BIN16 MR,13,13]
     
    MR=65535
    HSEROUT ["Then, all ones:",13]
    HSEROUT ["MR = ", BIN16 MR,13,13]
    
    for H=0 to 15
        MR.0[H]=0  'reset bit H of MR
    next H
    HSEROUT ["Next, all zeros again:",13]
    HSEROUT ["MR = ",BIN16 MR,13,13]
     
    for H=0 to 15
      MR.0[H]=1 'set bit H of MR
    next H
    HSEROUT ["And finally, all ones:",13]
    HSEROUT ["MR = ", BIN16 MR,13,13]
     
    Pause 10
    END
    Produces the following result on the serial terminal:
    Code:
    First, all zeros:
    MR = 0000000000000000
     
    Then, all ones:
    MR = 1111111111111111
     
    Next, all zeros again:
    MR = 0000000000000000
     
    And finally, all ones:
    MR = 1111111111111111
    The FOR-NEXT loop is copy-pasted from your post above. How do you know it's not setting the bit? Do you have serial line to which you can send the data as above? Is there any chanse something else in the program is resetting/changing MR before you have chanse to see it? What version of PBP? (I'm using 2.60)

    /Henrik.

  7. #7
    Join Date
    Mar 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: Bits, Bytes Words and Arrays

    Thanks,

    I tried to run the isolated code and it works. :S
    I'm sorry. I tested only the complete program before.

    Sure the problem is in the code between. the weird is it works compiled with PicBasic and not when compiled with PicBasicPro.

    I will check possible causes...

    Thanks again.

    Ricard.

Similar Threads

  1. LP Instant Interrupts Error
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th December 2009, 10:13
  2. how to store a very large amount of data
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 2nd April 2008, 07:05

Members who have read this thread : 3

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