Bits & Bytes


Results 1 to 8 of 8

Thread: Bits & Bytes

Threaded View

  1. #1
    electronicsuk's Avatar
    electronicsuk Guest

    Default Bits & Bytes

    Is it possible to act on a single bit within a byte, depending upon the value of a counter? For example, a simple chaser could be made using the code:
    HIGH portb.0
    HIGH portb.1
    HIGH portb.2
    HIGH portb.3

    However, it would be much better if this could be done with a counter. Something along the lines of:
    For counter = 0 to 3
    HIGH portb.counter
    NEXT

    PBP wont compile this. What would the code to do this look like? I was thinking of replacing .counter with (counter) but as far as I am aware, this only works with arrays. I tried it anyway, and it compiled, but as expected it didn't work.

    Ideas?

    Many thanks,
    Matthew
    Last edited by electronicsuk; - 26th December 2003 at 09:37.

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. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  3. byte compression
    By Norbert in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th June 2007, 18:04
  4. Need clever way to convert 10 bits to 8 bits
    By MikeTamu in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd September 2005, 15:13
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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