PIC16F628A Will not run at all....


Closed Thread
Results 1 to 14 of 14
  1. #1

    Default PIC16F628A Will not run at all....

    Can someone please tell me what I am missing? It seems to program, but no matter what I do, I can't get anything useful out of this POS...

    #CONFIG
    __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BODEN_ON
    #ENDCONFIG
    define OSC 4
    TRISB.1 = 0
    TRISB.2 = 0
    LOW PORTB.2
    LED var PORTB.1
    START:
    HIGH LED
    PAUSE(500)
    LOW LED
    PAUSE(500)
    HIGH LED
    PAUSE(500)
    LOW LED
    PAUSE(500)
    GOTO START

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    I don't see the oscillator register settings. You have to turn off comparators (if any). Did you pulled up the MCLR pin?

    Cheers

    Al.
    Last edited by aratti; - 17th May 2014 at 12:47.
    All progress began with an idea

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Quote Originally Posted by aratti View Post
    I don't see the oscillator register settings. You have to turn off comparators (if any). Did you pulled up the MCLR pin?

    Cheers

    Al.
    Yes MCLR is 5V+

    Isn't that what _INTRC_OSC_NOCLKOUT is for?

    Is there a way to set the config bits using binary in pbp3? I have been searching for hours and its extremely frustrating to have so many different ways to do it apearantly, and none of them seem to work right. And the one I KNOW will work right, I can't find a damn syntax for....

    My pic has a 14 bit config and I want 10000111111000 but I cannot figure out the command to enter it....

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    You could use assembler directives (if PBP allows them)

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    ok I got the PIC to run... But now I got no LCD. I may have jacked with it so much I trashed it. I hope not...

    '************************************************* ***************
    '* Name : HandHeld
    '* Author : John Moore
    '* Notice : Copyright (c) 2010
    '* : All Rights Reserved
    '* Date : May 16, 2014
    '* Version : 1.0
    '* Notes :
    '* :
    '************************************************* ***************
    #CONFIG
    __config 10000111100001
    #ENDCONFIG
    CMCON = 7

    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 3
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 2
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 1500
    DEFINE LCD_DATAUS 44


    LCDOUT $FE, $01
    START:
    LCDOUT "HELLO FKD"
    LCDOUT $FE, $C0 "UP WORLD!"

    GOTO START

    Somebody see something I am missing that's making the LCD play dead? Contrast works, no response past that tho...

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Try the code below. I added some pause statements.


    Code:
    '************************************************* ***************
     '* Name : HandHeld 
     '* Author : John Moore 
     '* Notice : Copyright (c) 2010 
     '* : All Rights Reserved 
     '* Date : May 16, 2014 
     '* Version : 1.0 
     '* Notes : 
     '* : 
     '************************************************* ***************
     #CONFIG
     __config 10000111100001
     #ENDCONFIG
     
    
     DEFINE LCD_DREG PORTB
     DEFINE LCD_DBIT 4
     DEFINE LCD_RSREG PORTB
     DEFINE LCD_RSBIT 3
     DEFINE LCD_EREG PORTB
     DEFINE LCD_EBIT 2
     DEFINE LCD_BITS 4
     DEFINE LCD_LINES 2
     DEFINE LCD_COMMANDUS 1500
     DEFINE LCD_DATAUS 44
    
    CMCON = 7
    TRISB = 0 ' make portb output. probably already done in lcd defines, but good habit to set all port dir.
    pause 1000 'let lcd initiate
    
     LCDOUT $FE, $01
     START:
     LCDOUT "HELLO FKD"
    
     LCDOUT $FE, $C0 "UP WORLD!"
    
    pause 100 ' slow down
     GOTO START
    
    end

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    I have no clue. Now I'm back to not working at all. And on top of that, now I've lost the page I found with the binary info to set the clock and I'm right back to square one cuz I can't set the clock. Everytime I try anything I find online, the syntax is wrong and I can't find it in the datasheet. After 2 solid months of this BS I'm about ready to use my Eastwing to fix it.....

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    OK! Thanks for the help everyone! I'm pretty sure I hosed up the LCD now. I went and kicked the S*** outta the neighbor's dog for about 20 min, then came back and tried again.... I remembered that I saved a "I know this s*** works" file for this chip when I finally got it running. It's set for 4mhz. I was using a 12 crystal, so my ten second pause lasted only 3. Fair enough. I switched to an 8, 5 seconds, cool. Switched to a 4.00, and 10000 = 10 seconds... fabulous! Added the code for the LCD, LED still blinky blinky.... awesome! Added the LCD to the circuit.... LED still blinky blinky, contrast and backlight still work, but no other activity from the LCD.....

    #CONFIG
    __config 10000111100001
    #ENDCONFIG

    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 3
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 2
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 1500
    DEFINE LCD_DATAUS 44

    LED VAR PORTB.1
    CMCON = 7
    TRISB = 0 ' make portb output. probably already done in lcd defines, but good habit to set all port dir.

    High LED
    PAUSE(1000)
    LOW LED
    LCDOUT $FE, $01

    START:
    LCDOUT "HELLO FKD"
    LCDOUT $FE, $C0, "UP WORLD!"
    HIGH LED
    PAUSE(1000)
    LOW LED
    PAUSE(1000)
    GOTO START
    end

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Hi,
    The problem is that previously there was two different ways of setting the CONFIG bits depending on which assembler you were using. With the introduction of PBP3 both those ways got superseded by a, MUCH better, third way.

    With PBP3, which you must have since you've been using the #CONFIG/#ENDCONFIG directives the easiest way is to look in the DEVICE_REFERENCE folder and open up the .INFO file for your particular device. There you will find two things, A) What PBP is using by default and B) All the options available. Just remember that whenever you put the #CONFIG/#ENDCONFIG in your program ALL of the PBP default settings will be replaced so make sure that you either include a setting for all selections or know what they are by (hardware) default.

    Yet another option is to use the new meCONFIG from meLabs and let it generate the CONFIG code for you.

    The internal oscillator of the 16F628A is 4MHz by default, and there is no oscillator register setting, only a frequency select bit in PCON, so you shouldn't need to do "anything" really - except for selecting it of course. The .INFO file for the 16F628A shows two selections INTRC_OSC_NOCLKOUT and INTOSC_OSC_NOCLKOUT however they both result in the same thing, namely that the two LSB's of the CONFIG word being cleared which matches the datasheet for the INTOSC with I/O on RA6/RA7 selection.

    My pic has a 14 bit config and I want 10000111111000 but I cannot figure out the command to enter it....
    This, however does not look correct if what you want is the internal oscillator. As far as I can see this would select external low power crystal mode - not internal oscillator.

    Then, in your actual code you had
    Code:
     #CONFIG
     __config 10000111100001
     #ENDCONFIG
    Which again doens't look correct, this would select XT-oscillator.

    So, please clarify which mode it is you want. If it's the internal oscillator then the code in the original post looks fine to me. There are no analog functions on PortB.

    Which device programmer are you using? Are you sure that it's actually programming the CONFIG bits into the device?

    /Henrik.

    EDIT: OK, you posted while I was researching and typing.
    Last edited by HenrikOlsson; - 19th May 2014 at 06:42.

  10. #10


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Sorry. Yes I am using an external on that chip. What I am doing is building a self-acquiring satellite system for data. (HughesNet) It will have a MC in the dish itself where all the "important thinking" will be happening. And then there will be a wireless handheld device connected via HC-05's. This will also allow for a cell phone app to control it via a customized BTserial-type app.

    I just got the handheld to start (sorta) working now (minus the blown LCD I'm now waiting for)
    I got the HC-05's linked

    I just blew the last 688 I had for the embedded half. I switched out to a PICAXE14M2 I had laying around. (BTW this is the chip that got me over to PIC from Arduino) Since I now have a picKIT3, I wiped the bootloader and am using it as a 1825. This board is soldered already, and I used the pins for the CLK for something else. The internal clk would be fine but now a 10000 pause is 80 seconds. I cannot go down past OSC 4, and this is still 8 times to slow. How do I rectify this?



    Is it really hijacking if it was your own thread?? ;-)

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    With PBP3, which you must have since you've been using the #CONFIG/#ENDCONFIG directives the easiest way is to look in the DEVICE_REFERENCE folder and open up the .INFO file for your particular device. There you will find two things, A) What PBP is using by default and B) All the options available. Just remember that whenever you put the #CONFIG/#ENDCONFIG in your program ALL of the PBP default settings will be replaced so make sure that you either include a setting for all selections or know what they are by (hardware) default.

    Yet another option is to use the new meCONFIG from meLabs and let it generate the CONFIG code for you.
    Yes, thank you. I had found this right before reading your post. Honestly, with the three different ways, plus finding C code in searches as well, this makes learning how to do the config extremely frustrating. Every time you think you understand a little part of it, it gets changes on you 2 more times...lol I found the reference to the configs in the device folder in the PBP manual and now FINALLY I understand it. (Sure wish I had known about that low voltage programming before I scrapped out that chip turning off MCLRE!) I haven't checked out the melabs tool yet, maybe I will. So far I am totally unimpressed with MPLAB altogether. I am so sick of retyping my work because they have boycotted the tilde for some reason. Also, pasting ANYTHING with most symbols locks it up tight too. I'm about to try out MC Studio....

  12. #12
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Hi,
    Yes, I understand it's confusing with the pre PBP3 style CONFIG. It's a lot better with PBP3 than it was before though! However, I've got no sympathy for looking at C code and trying to implement THAT in PBP :-)

    As for MPLAB(X) there is ONE reason (for me that is) to use it with PBP and that's source level debugging, if you don't need that then you don't need MPLAB(X). Personally I've tried to get MBLABX up and running twice and given up both times, feeling very stupid on both occasions.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    Quote Originally Posted by thasatelliteguy View Post
    Yes MCLR is 5V+

    Isn't that what _INTRC_OSC_NOCLKOUT is for?
    The config tells the PIC you want it to use the internal OSC, DEFINE OSC 4 tells PBP you are using 4 mhz so it knows how to adjust it's timing to agree with your intentions. I believe 4mhz is PBP default, but would not depend on defaults, period. Always define in your code what you expect, and the surprises (like not working) disappear.
    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.

  14. #14


    Did you find this post helpful? Yes | No

    Default Re: PIC16F628A Will not run at all....

    I have now been on MC Studio for a couple days, and I have to say it rocks compared to mplabx. It auto-corrects capitalizations, and best of all it doesn't seize like an epileptic in a disco every five minutes...

Similar Threads

  1. RTC run too fast
    By pedja089 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th December 2012, 19:17
  2. Run-Time Config
    By Darrel Taylor in forum PBP Extensions
    Replies: 1
    Last Post: - 1st February 2012, 16:26
  3. 16F628 does not run. I can't believe this
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd October 2009, 15:41
  4. Intermittent code cannot run
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th November 2008, 02:45
  5. How to run program in parallel?
    By vanxn in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th July 2006, 21:59

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