bit, byte or word?


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default bit, byte or word?

    Hello Everyone. I thought I had this figured out but someone's post has confused me. At the top of my program I put:
    x var byte

    now, any reference to the adcin command reads back to me a number from 0 to 255 when I put it into x. It works perfectly. Now, if I put:
    x var word

    what number will it read to? I thought is was 0 - 1023 but someone's post refers to the number being 65535.

    One more - what will x var bit read to? - Thank you.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    A word is 16 bits...

    16 bits gives you a range from 0-65535

    The internal ADC in most PIC's is 10 bits...

    10 bits gives you a range from 0-1023

    You need a WORD variable if in PBP you want to play with numbers bigger than 255 (a BYTE). When reading from your ADC, your WORD variable will acquire a value in the range 0-1023... the upper bits will be zero.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thank you Melanie. And how about a bit variable? What does that count up to? Thank you.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I never thought I'd find myself answering this one but...

    A bit is the smallest variable you can have... represented by one wire, one pin, one-eighth (1/8) of a byte... in the Digital world, this can only be Zero (0) or One (1)... there is no other state.

    So the variable range for a BIT is 0-1. It's either a Zero or a One, that's it...

    Like I always say to everyone... if you can count to ONE, you're a computer expert, because that's all ANY Digital computer does... it just might happen to do it damn quick, but basically if you can understand that concept, then that's all there is to computers... micro, mini or mainframe... if you can count to one (or have an IQ equal to or greater than a BIT), you too can earn big bucks...

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thank you Melanie. My IQ = a bit but I don't make big bucks.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Life isn't so bad... it still rates you over the average Politician, Lawyer, Real-Estate Agent...

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. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  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. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  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 : 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