Control a Radio PLL with a PIC


Closed Thread
Results 1 to 40 of 54

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    Quote Originally Posted by RayL113 View Post
    I'm trying to assign 4 pins from PORTA as the CHSEL f/register as follows;

    CHSEL = PORTA.1.2.3.4
    Get this error;
    C:\PBP\PLL-CPU.BAS ERROR Line 24: Bad variable modifier: .1.2.3.4
    I've tried different variations on this (1-4) (1234) etc. but with the same results.
    What is the correct syntax for doing this? I only want to use these 4 pins.
    You need to use BitWise masks for that

    chsel = (PORTA>>1) & $0F

    you'll need to use that line each time you want to read from PORTA.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Jun 2011
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    Quote Originally Posted by mister_e View Post
    You need to use BitWise masks for that

    chsel = (PORTA>>1) & $0F

    you'll need to use that line each time you want to read from PORTA.
    Thanks Steve.
    But what is this doing? I mean is it assigning pins 1 thru 4 to the CHSEL label?
    And "Bitwise Mask". I don't see that in the manual. What does it mean?
    There's got to be an easier way to do this than having to insert that line every time.
    What is the best way to assign input pins to a register in PBP?
    For that matter, how do you assign anything to a register in PBP. Can't find that in the manual either!

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    CHSEL VAR PORTA

    This will assign the whole PORTA, all the time to chsel variable... it's a simple alias. Still, it's the WHOLE PORTA reading, you still need to remove the bit you don't want/need.

    If you want to assign a single pin to a variable
    A_SINGLE_PIN VAR PORTA.0

    As far as I'm aware of, there's no shortcuts. Bitwise & Logical mask/operations are indeed listed in the manual, not explained as it's a basic knowledge you should already be aware of when programming. Case not, there's Wikipedia & Google
    http://en.wikipedia.org/wiki/Bitwise_operation
    http://www.ralphb.net/IPSubnet/logical.html
    and so forth
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    chsel var byte
    '
    '
    '
    '
    chsel = (PORTA>>1) & $0F

    this read PORTA, shift the whole value one place to the right (to remove PORTA.0), then isolate the 4 lower bits.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jun 2011
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    Quote Originally Posted by mister_e View Post
    chsel var byte
    '
    '
    '
    '
    chsel = (PORTA>>1) & $0F

    this read PORTA, shift the whole value one place to the right (to remove PORTA.0), then isolate the 4 lower bits.
    Ok, so let's say then, that I don't use the lsb as the toggle pin, and use 0 thru 3 as my 4 input bits, would the command be chsel = (PORTA) %00001111 ??
    Or am I missing the point?

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    Really close
    chsel = PORTA & %00001111
    you're on the right direction!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jun 2011
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Control a Radio PLL with a PIC

    Quote Originally Posted by mister_e View Post
    Really close
    chsel = PORTA & %00001111
    you're on the right direction!
    Thanks! I'll give that a try.

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