Help Pic16f628a


Closed Thread
Results 1 to 7 of 7

Thread: Help Pic16f628a

  1. #1
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240

    Default Help Pic16f628a

    Hi everyone;

    I'm trying to program a PIC16F628A with internal oscilator and no MCLR Resistor, however, it does not Work, and i donīt know what i'm doing wrong; can you help me ?

    Here goes the code;

    @ DEVICE pic16F628A, INTRC_OSC_NOCLKOUT
    @ DEVICE pic16F628A, WDT_ON
    @ DEVICE pic16F628A, PWRT_ON
    @ DEVICE pic16F628A, MCLR_OFF
    @ DEVICE pic16F628A, BOD_OFF
    @ DEVICE pic16F628A, LVP_OFF
    @ DEVICE pic16F628A, CPD_OFF
    @ DEVICE pic16F628A, PROTECT_OFF


    '76543210
    TRISA = %00000000
    TRISB = %00001110
    CMCON = 7
    VRCON = 0



    Led1 VAR TRISB.6
    Led2 VAR TRISB.5
    Led3 VAR TRISB.4


    Main:
    HIGH Led1
    PAUSE 2000
    LOW Led1
    HIGH Led2
    PAUSE 2000
    LOW Led2
    HIGH Led3
    PAUSE 2000
    LOW Led3
    Goto Main


    END


    Regards
    Gadelhas
    Last edited by gadelhas; - 26th August 2008 at 21:28.

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


    Did you find this post helpful? Yes | No

    Default

    You wrote INTOSC_OSC_NOCLKOUT

    Shouldn't it be INTRC_OSC_NOCLKOUT

    Unfortunately, mistakes and typo's in DEFINE statements rarely produce compiler errors, so it's worthwhile double checking you have those correct.

    Where can you find the correct settings you might ask... see this thread...

    www.picbasic.co.uk/forum/showthread.php?t=543

  3. #3
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    You wrote INTOSC_OSC_NOCLKOUT

    Shouldn't it be INTRC_OSC_NOCLKOUT

    Unfortunately, mistakes and typo's in DEFINE statements rarely produce compiler errors, so it's worthwhile double checking you have those correct.

    Where can you find the correct settings you might ask... see this thread...

    www.picbasic.co.uk/forum/showthread.php?t=543

    Melanie; thanks for answer, but unfortunately, i made that change, but still not working!

    Can you see if theres anything wrong or missing, again?

    Regards
    Gadelhas

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gadelhas View Post
    Melanie; thanks for answer, but unfortunately, i made that change, but still not working!
    Hi gadelhas,
    Could you please define " not working"?
    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.

  5. #5
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hi gadelhas,
    Could you please define " not working"?
    Hi Joe;

    Donīt do nothing, all leds off.

    Regards
    Gadelhas

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


    Did you find this post helpful? Yes | No

    Default

    I found your problem.
    Code:
    @ DEVICE PIC16F628A, INTRC_OSC_NOCLKOUT
    @ DEVICE PIC16F628A, WDT_ON
    @ DEVICE PIC16F628A, PWRT_ON
    @ DEVICE PIC16F628A, MCLR_OFF
    @ DEVICE PIC16F628A, BOD_OFF
    @ DEVICE PIC16F628A, LVP_OFF
    @ DEVICE PIC16F628A, CPD_OFF
    @ DEVICE PIC16F628A, PROTECT_OFF
    
    
    '76543210
    TRISA = %00000000
    TRISB = %00001110
    CMCON = 7
    VRCON = 0
    DEFINE OSC 4
    
    Led1 VAR PORTB.6
    Led2 VAR PORTB.5
    Led3 VAR PORTB.4
    
    
    Main:
    HIGH Led1
    PAUSE 2000
    LOW Led1
    HIGH Led2
    PAUSE 2000
    LOW Led2
    HIGH Led3
    PAUSE 2000
    LOW Led3
    Goto Main
    
    
    END
    Simple mistake on your variables you wrote
    Led1 VAR TRISB.6
    Led2 VAR TRISB.5
    Led3 VAR TRISB.4

    should be :
    Led1 VAR PortB.6
    Led2 VAR PortB.5
    Led3 VAR PortB.4
    Last edited by Archangel; - 26th August 2008 at 23:17.
    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.

  7. #7
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    I found your problem.
    Code:
    @ DEVICE PIC16F628A, INTRC_OSC_NOCLKOUT
    @ DEVICE PIC16F628A, WDT_ON
    @ DEVICE PIC16F628A, PWRT_ON
    @ DEVICE PIC16F628A, MCLR_OFF
    @ DEVICE PIC16F628A, BOD_OFF
    @ DEVICE PIC16F628A, LVP_OFF
    @ DEVICE PIC16F628A, CPD_OFF
    @ DEVICE PIC16F628A, PROTECT_OFF
    
    
    '76543210
    TRISA = %00000000
    TRISB = %00001110
    CMCON = 7
    VRCON = 0
    DEFINE OSC 4
    
    Led1 VAR PORTB.6
    Led2 VAR PORTB.5
    Led3 VAR PORTB.4
    
    
    Main:
    HIGH Led1
    PAUSE 2000
    LOW Led1
    HIGH Led2
    PAUSE 2000
    LOW Led2
    HIGH Led3
    PAUSE 2000
    LOW Led3
    Goto Main
    
    
    END
    Simple mistake on your variables you wrote
    Led1 VAR TRISB.6
    Led2 VAR TRISB.5
    Led3 VAR TRISB.4

    should be :
    Led1 VAR PortB.6
    Led2 VAR PortB.5
    Led3 VAR PortB.4

    Hi Joe;

    I simple just canīt belive it; what a stupid mistake. I never do that.

    It's allready working. Thanks for everthing.

    Regards
    Gadelhas

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. Do I need a pause?
    By tazntex in forum Serial
    Replies: 21
    Last Post: - 29th August 2008, 04:32
  3. Changing bits in a byte for multiple output
    By tazntex in forum Serial
    Replies: 3
    Last Post: - 11th August 2008, 19:10
  4. Replies: 8
    Last Post: - 22nd July 2008, 20:31
  5. Interrupt & device setup for a PIC16F628A in Microcode Studio Plus
    By wildpikachu in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 3rd May 2008, 16:28

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