Bit grouping


Closed Thread
Results 1 to 4 of 4

Thread: Bit grouping

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    bearpawz,

    I think you need to rethink your approach a "bit":

    All the names you want to use like ADFM, ADCS1, ADCS2, etc., are already predefined as constants in the required .inc file. I am not sure of the implications of renaming them. Others might know.

    ADCON0.6 datasheet name is ADCS0 ' (not ADCS2)
    ADCON0.7 datasheet name is ADCS1
    ADCON1.6 datasheet name is ADCS2

    You actually need to control all three together (not just two bits) to control the TAD time, remembering that two are in ADCON0 and the other is in ADCON1

    I know of no PBP shorter way to assign bits than the method you show at the bottom of your post. I think you could “use” a full 8 bit variable to hold the three separate bit values but would still have to distribute them to two other variables (ADCON0 and ADCON1).

    Something tells me you could set this up to be automated in a manner similar to that shown here

    http://www.picbasic.co.uk/forum/showthread.php?t=3891

    using Darrel's excellent trick/secret but some ASM would be required. I have not fully explored as of yet.

    Lastly, Joe pointed you to an excellent link on dealing and tracking bits using arrays - you should look here too.

    Let us know ...
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  2. #2
    Join Date
    May 2004
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    Ive already looked through that thread but thanks. And Im too tired now to even comprehend any assmebly... its almost 1AM and all these 1's and 0's are giving me a head ach.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 08:55
  2. Doubt with interrupt on change
    By lugo.p in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th March 2010, 16:22
  3. Sleep Mode
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th March 2008, 11:31
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 01:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

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