Basic question about Aliases


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2008
    Posts
    52

    Default Basic question about Aliases

    I am still on a learning curve here so please bear with me.

    I have been trying to make use of byte0 and byte1. Shouldn't this flash leds on portb? Must be doing something wrong.

    Thanks, Don

    Code:
    TRISB = %00000000
    
    loop:   
    
    x var word
    x = %00101111
           
           portb = x.byte0          
           pause 1000
           portb = x.byte1
           pause 500
           
          
            Goto loop             
      End

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    You've defined x as a word. That's 16 bits. You've assigned 8 bits of X. PortB is 8 bits too. X.Byte0 chooses the lower 8 bits of X and X.Byte1 chooses the higher 8 bits of X.

  3. #3
    Join Date
    Oct 2008
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Thanks Jerson,

    I figured it was somethig simple like that. Thanks for taking the time to reply

    Don

  4. #4
    Join Date
    Oct 2008
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    Also, I was trying to figure if this is how this worked.

    X = %00001111

    X = X | %010000000

    Is %01001111 the value of X now?

    Thanks, Don

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  2. A simple and basic question
    By Ted's in forum mel PIC BASIC Pro
    Replies: 35
    Last Post: - 29th June 2008, 19:01
  3. Visual Basic 6 question
    By Christopher4187 in forum Off Topic
    Replies: 5
    Last Post: - 3rd July 2006, 13:06
  4. Experimenting With Pic Basic Pro Question
    By jabahunter in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th May 2005, 08:16
  5. Basic Question about PICBASIC
    By zonkwilliams in forum General
    Replies: 1
    Last Post: - 10th March 2005, 21:55

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