PIC16F767 blinking code


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1

    Default PIC16F767 blinking code

    Hello Guys,

    I'm having some problems trying to make this pic to work, do you see anything wrong with my blinking code?

    @ DEVICE PIC16F767, INTRC_OSC_NOCLKOUT, WDT_ON, PROTECT_OFF
    OSCCON=%01111000 '8Mhz
    TRISB = 0

    loop:
    High PORTB.7
    Pause 500
    Low PORTB.7
    Pause 500
    GoTo loop
    End

    Anything missing on the @ statement?

    Thank you very much.

    Regards,
    Daniel.

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Two ideas to try:

    1) Try OSCCON %01110000 instead of %01111000 (you do not appear to be switching from a Primary OSC - see first few paragraphs of datasheet section 4.6 and description (and foot note) of OSCCON<3>)

    2) What are you doing with MCLR - is it tied high?
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Hi Paul,

    Thanks for your help, I've been working with pics for almost four years now, but never used the internal oscillator before.

    I think I'm having some problems with my parallel programmer, because is not programming the code.

    Do you know if the 16F767 need any special requirement to be programmed?

    Thank you very much.

    Regards,
    Daniel.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    At last, after two weeks and a new programmer, a 16F767 working blinking code:

    @ DEVICE PIC16F767, INTRC_OSC_NOCLKOUT ; System Clock Options
    @ DEVICE PIC16F767, WDT_ON ; Watchdog Timer
    @ DEVICE PIC16F767, PWRT_ON ; Power-On Timer
    @ DEVICE PIC16F767, MCLR_OFF ; Master Clear Options (Internal)
    @ DEVICE pic16F767, PROTECT_OFF ; Code Protect Off

    OSCCON=%01110000

    main:
    High PORTB.7
    Pause 500

    Low PORTB.7
    Pause 500

    GoTo main
    End

  5. #5
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Hi Daniel,

    Is "DEFINE OSC 8" necessary in this case or not?

    Eventhough you set OSCCON, how does PBP know that it is 8Mhz?

    ------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Because OSCCON=%01110000 sets the internal oscillator to 8Mhz...

    Read the 16F767 datasheet section 4.6.3 for other frequencies...

    PICs makes me love and hate them at the same time....

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  3. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  4. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  5. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26

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