External osc defines


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Mpasm

    Hi Bruce,

    Iīm using Micrchips MPASM and PBP 2.50

    Did you use 20 MHz on a veroboard?

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I have never used vero board or a 20MHz canned type TTL clock oscillator, but I do use
    20MHz crystals & resonators on breadboards pretty often.

    What is the error you're seeing when you compile? The example I posted compiles fine here!

    Edit: Which PIC are you compiling for? There are differences in config options between some
    device types.
    Last edited by Bruce; - 12th February 2008 at 12:47. Reason: PIC type
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Talking Found mistake on design homepage

    Hi Guys!

    This works:

    '************************************************* *******************************************
    ' 16F628A 20Mhz extern canned Oscillator
    ' damn program should blink an LED
    ' Yeah Works!
    '************************************************* *******************************************

    @config_EXTCLK_OSC


    DEFINE OSC 20
    LED VAR PORTB.7
    CMCON = 7 ' RA0-RA3 are digital I/O

    TRISB = %01111111 ' RB7 is output, rest are inputs.

    main:
    led = 1
    pause 500
    led = 0
    pause 500
    goto main

    END ' End of program

    And heres the mistake:
    http://hobby_elec.piclist.com/e_pic8_8.htm

    Look at the osc wiring diagram: ext osc MUST be connected to RA6! hahahaha!

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I'm glad you got that working, however, this @config_EXTCLK_OSC is totally not a good or valid config directive.

    It doesn't throw an error, but it also doesn't do anything. I suspect you have whatever default config settings in the device .INC file that are actually being used.

    It may work, but you will have issues down the road with your canned oscillator, PIC, or both shortly. RA6 on this device is NOT the external clock input. RA7 is.

    If you have a canned oscillator, like the 2nd picture in this link http://hobby_elec.piclist.com/e_pic8_8.htm then you do not want to connect the output of this oscillator to RA6.

    If you have XT, HS or any other config setting to enable the OSC2 output, then you have two outputs connected together, and you'll want a lot of spare parts.

    If you're using the default PM assembler;

    @ DEVICE EXTCLK_OSC, WDT_OFF, MCLR_OFF, LVP_OFF, PROTECT_OFF

    If you have MPASM selected as the assembler;

    @ __config _EXTCLK_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF

    Note: Option #2 will indeed return an error unless you have the MPASM config line in the default 16F628A.INC file commented out.

    If your device programmer supports it, simply compile, open the .hex file, and verify your config settings. If it is NOT set to EC oscillator, then you will for sure have major problems down the road. Just FYI.

    It may work with XT or HS since you have a canned oscillator output connected, but I wouldn't expect something like this to last since OSC2 would also be trying to drive the external crystal.

    If you have a 20MHz crystal, then the circuit shown in the 1st graphic is the way to go.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Mugelpower View Post
    Hi Guys!

    This works:

    '************************************************* *******************************************
    ' 16F628A 20Mhz extern canned Oscillator
    ' damn program should blink an LED
    ' Yeah Works!
    '************************************************* *******************************************

    <font color=red> @config_EXTCLK_OSC</font color> ' Incorrect way<br>
    <font color = blue>@ __config _EXTCLK_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF</font color> ; MPASM Assembler<br>
    <font color=green>@ DEVICE EXTCLK_OSC, WDT_OFF, MCLR_OFF, LVP_OFF, PROTECT_OFF</font color> ; PM ASSEMBLER


    DEFINE OSC 20
    LED VAR PORTB.7
    CMCON = 7 ' RA0-RA3 are digital I/O

    TRISB = %01111111 ' RB7 is output, rest are inputs.

    main:
    led = 1
    pause 500
    led = 0
    pause 500
    goto main

    END ' End of program

    And heres the mistake:
    http://hobby_elec.piclist.com/e_pic8_8.htm

    Look at the osc wiring diagram: ext osc MUST be connected to RA6! hahahaha!
    I'll bet you had to set the OSC fuse manually on the programmer ! Do it the way Bruce showed you and it will set automaticly when you load the hex file.
    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.

  6. #6
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Default osc setting manually no go

    Hi Joe,

    iīm using the PicKit2 and i didnīt find any osc settings in the programmer window. That was what I tried at first.

    had the Velleman programmer before and this had the possibility to set osc configs. But that one died long ago.....simply didnt work anymore.

    on the other hand: PicKit2 is fast an easy to use and supports everything, even the 16F628A...hahaha

  7. #7
    Join Date
    Jan 2008
    Location
    Selm, Germany
    Posts
    116


    Did you find this post helpful? Yes | No

    Question RA6 works.....RA7 not!

    Hi Bruce,

    I know the datasheet shows RA7 is external clock in..but I dont get it working. When connecting to RA6 it works. should I try a long-time test if the pic gets to hot? maybe a resistor between canned oscillator and PIC?

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


    Did you find this post helpful? Yes | No

    Default

    Hi Mugelpower,
    Here is what I think, <b>I say think because I do not definately know.</b> Being that your config fuse setting is WRONG, I think your PIC is not properly set up for EXT OSC and that is why it will not accept input on RA7, I THINK it it using the oscillator as a crystal, somehow getting enough signal to work, elsewise it may be defaulting to int osc, who can say? Try sending out some serial data to a serial lcd and see if it scrambles the data, better yet correct your config statement and then try the OSC on it's proper pin. I compiled your code both ways and the hex files have some distinct differences. One more thought, the PIC is probably using the default config statement in the 16F628A.inc file, unless you have commented it out.
    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.

Similar Threads

  1. Internal vs. external osc for comms
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2010, 14:58
  2. Replies: 1
    Last Post: - 28th January 2010, 22:15
  3. 18F1320 with external osc
    By Mugelpower in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th February 2008, 22:32
  4. How to use an external oscillator
    By Mugelpower in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th February 2008, 14:19
  5. External clock
    By Firegod in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th March 2007, 00:53

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