16F628 and LMX2306 PLL loading.. help


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Jan 2007
    Posts
    15

    Default 16F628 and LMX2306 PLL loading.. help

    OK, I have been trying to get this to work in my spare time over the past couple weeks and I seem to have hit a roadblock.

    Using a 16F628 PIC I am trying to load bit strings into an LMX2306 PLL chip using SHIFTOUT commands. The PLL is never loading. I used almost Identical code in a Parallax Basic Stamp Homework Board and it worked no problems.

    PLL is confirmed working by plugging it into National's codeloader software and also my Parallax board. All connections have been checked many many times. Here is the code if anyone would like to see if I am missing something simple.

    Please help me, I know there are some big brains around here.


    CODE:-------------------------------------

    TRISB = %11111111 'set all pins 0-7 to input
    TRISA = %00111100 'set pins 0,1,6,7 to output and pins 2,3,4,5 to input
    CMCON = %00000111 'turn off on-board comparators

    Include "modedefs.bas"

    Low PORTA.6

    Pause 500

    SHIFTOUT PORTA.7,PORTA.0,MSBFIRST,[0\13, 131\8] 'send F reg
    High PORTA.6 'LE high
    PAUSE 10
    Low PORTA.6 'LE low


    SHIFTOUT PORTA.7,PORTA.0,MSBFIRST,[0\9, 4000\12] 'send R reg
    High PORTA.6 'LE high
    PAUSE 10
    Low PORTA.6 'LE low


    SHIFTOUT PORTA.7,PORTA.0,MSBFIRST,[1\1, 2566\13, 2\5, 1\2] 'send N reg
    High PORTA.6 'LE high
    PAUSE 10
    Low PORTA.6 'LE low

    -------------------------------------:END CODE

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    You're using Port A.7, which is also OSC1.
    Are you sure you've configured the clock correctly to use this pin as an I/O?
    http://www.picbasic.co.uk/forum/show...setting+config

    Are you sure you're PIC is even running in the first place? How does that blinky LED work?

  3. #3
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    The LE high and low is not an LED but a Latch enable on the PLL chip to tell it to load in the data in the shift register when shifting is done.

    I probably should set an led somewhere to blink to confirm operation of the micro controller. Will do this next.

    I am using an MELabs U2 Programmer. It reads and writes no problems. I have set the oscillator to INTRCIO in the MELabs programmer, which should be the internal oscillator?, and still no dice.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kessral View Post
    I probably should set an led somewhere to blink to confirm operation of the micro controller. Will do this next.
    It's always been my 2nd step after a failure...
    Actually that's not true. Everything I've built in the past few years has included a 'heartbeat' LED driven by a timer interrupt. LED blinks, no questions as to whether or not the circuit is operating...correctly or otherwise...

  5. #5
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Well I changed the code to this:

    TRISB = %11111111 'set all pins 0-7 to input
    TRISA = %00111100 'set pins 0,1,6,7 to output and pins 2,3,4,5 to input
    CMCON = %00000111 'turn off on-board comparators

    Include "modedefs.bas"

    Low PORTA.1 'for LED
    Low PORTA.6

    Pause 500

    SHIFTOUT PORTA.7,PORTA.0,MSBFIRST,[0\13, 131\8] 'send F reg
    High PORTA.6 'LE high
    PAUSE 10
    Low PORTA.6 'LE low

    high porta.1
    pause 500 'blink LED
    low porta.1

    SHIFTOUT PORTA.7,PORTA.0,MSBFIRST,[0\9, 4000\12] 'send R reg
    High PORTA.6 'LE high
    PAUSE 10
    Low PORTA.6 'LE low

    high porta.1
    pause 500 'blink LED
    low porta.1

    SHIFTOUT PORTA.7,PORTA.0,MSBFIRST,[1\1, 2566\13, 2\5, 1\2] 'send N reg
    High PORTA.6 'LE high
    PAUSE 10
    Low PORTA.6 'LE low

    high porta.1
    pause 500 'blink LED
    low porta.1

    ---------------------------------------------
    No blinking going on and no highs on an scope from pin 18. Does this mean it is a bad chip even though it reads and writes fine? Or is there something amiss/wrong in my code?

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by kessral View Post
    Well I changed the code to this:
    well then, change the code to this:
    Code:
    trisb=$ff:trisa=$3c:cmcon=7
    main: porta.1=1:pause 500:porta.1=0:pause 500:goto main
    goto main
    That's known as ol' blinky... See how it's about as simple as you can get...the lowest common denominator...end of the line...edge of the cliff...low man on the pole...last drop in the bucket...
    If something like that doesn't work, then I'd be willing to bet that any communications you are trying to do with that LMX2306, or any other chips anywhere in this world (or others) at this time (or any other in the past or the future or otherwise) isn't going to work either.

    Does this mean it is a bad chip even though it reads and writes fine?
    I've got this car in the backyard. The doors open and close just fine...but it won't start. Does that mean the whole car is bad?

    Or is there something amiss/wrong in my code?
    Ya think?
    Is your circuit perfect? Are you sure? HOW can you be sure? Does the code you've tried run? No? Then you can't be sure your circuit is perfect... ALL you can do is assume.

    In other words..............
    Break it back down...then build it up in steps...

  7. #7
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Yes! The circuit is perfect! Everything is perfect, its just bad luck. LOL J/k

    I will try replacing the chip Monday and I'll get back with the results. I am teaching myself this micro controller stuff right now so thanks for all your help and patience.

    Have a good weekend.

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default The answer is probably in front of you . . .

    Hi Kessral,
    Go back to post #2 where Ski gave you the answer . . . How are your configs set? How have you configured the OSC. ? Have you looked at what Ports A5,6,7 do?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Have you looked at what Ports A5,6,7 do?
    16F628...not 16F628A... doesn't apply in this case...well, mostly doesn't apply.

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    16F628...not 16F628A... doesn't apply in this case...well, mostly doesn't apply.
    Not sure what YOU mean Jeremy, I meant 5=mclr 6= osc/clkout, 7= osc/clkin, if he is using xtal or resonator, or wrong configs then ports will not work. Is there a pullup resistor on a.5? Is there a .1 µf cap between pins 5 and 14 ? Sometimes it helps to erase the chip several times prior to programming too.
    Last edited by Archangel; - 24th May 2008 at 09:37.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Not sure what YOU mean Jeremy
    Ok, I thought that you might have been thinking analog vs. digital pins.
    F628 has comparators but no ADC, F628A has both...
    I've shot myself in the foot more than once by forgetting that sort of thing

  12. #12
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    F628 has comparators but no ADC, F628A has both...
    I don't see ADC just VREF I never used ADCON on the 628A I know there are differences in the 628 vs 628A, I never actually used the non-A version, I have the feeling his chip is not doing anything, for the above stated reasons.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  13. #13
    Join Date
    Jan 2007
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    OK it's working!

    Had to play with configuration settings, turned off WDT and everything that I did not need. Also added a bypass capacitor between pins 5 and 14.

    Sorry this took so long as I had gone on vacation for a week and have been otherwise tied up.

    Thanks for all your help and input!

  14. #14
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    GREAT ! Good to see success ! Thanks for the follow up.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Members who have read this thread : 1

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