More trouble - Just can't figure it out.


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    67

    Default More trouble - Just can't figure it out.

    I rarely find a challenge I can't overcome by just thinking it out a bit, but I've got to say this attempt at using the PIC has just been endless confusion and frustration. I just don't know what I'm doing wrong and I can't find anything that I'd consider a really straight forward "beginner's" guide. I've been writing web and database software for years using some pretty high extreme SQL and PHP - and I'm getting the gist of some of this ASM stuff. I've been boarding out my own discrete circuits for quite a while also but trying to blend the bread board with software has just de-railed me.

    I've got some 16F688's here - I picked them because they seemed like a good match on the site where I ordered the PBP compiler and the USB programmer.

    I used their example program "blink" and just hooking it to a board with nothing but +3v, ground, and a 0.1uF noise cap off a regulated power supply - it pulls almost 200 mA of juice and burned up one 3v regulator. Something is wrong.

    Here is the exact code I had in MicroCode Studio:

    Code:
    ' Example program to blink an LED connected to PORTB.0 about 
    ' once a second
    
    loop:   
       High PORTC.5          ' Turn on LED connected to PORTB.0
       Pause 500       ' Delay for .5 seconds
    
       Low PORTC.5           ' Turn off LED connected to PORTB.0
       Pause 500       ' Delay for .5 seconds
    
       Goto loop       ' Go back to loop and blink LED forever
       End
    I changed PORTB.0 to PORTC.5 because the F688 doesn't seem to have a PORTB.

    I compiled it with no errors, then in meProg, I selected the right PIC from the drop down, and set the following options:

    Oscillator: INTOSCIO
    WDT: Enabled
    P-up Timer: Disable
    MCLR Pin: Reset
    Brown out: Enabled
    Int Ext Switch Over: Enabled
    Fail-Safe Clock: Enabled
    Code: Not Protect
    Data EEPROM: Not Protect

    It seemed to program just fine, no errors, the light went red then green just as expected.

    I tried it with and without a pull-up on MCLR and same thing - it draws tons of juice and basically does nothing. I've got a few of the PIC's so I tried to flash several of them - each the same thing.


    I'm also having a real hard time understanding how to select the oscillator source - the data sheet is very cryptic to me. It sounds as if INTOSCIO is the same description as INTOSC. It also seems I need to set this frequency in the registers, but I "DEFINE OSC 4" or "DEFINE OSC 8" in PBP - I don't know if that actually changes the clock speed or if I need to still manually edit the registers, and speaking of that - the data sheet seems to say it's got something to do with INTOSCIO, HFINTOSC and teh FOSC bits in the CONFIG register, but also talks about the SCS bit in the OSCCON reg, and the IRCF bits there. I've got scratch paper all over my desk with these crypic names and register values - I realize that's just how it is, but I really wish there was something written somewhere that just put it really straight and easy:

    "Set the value of this register to this by typing {THIS} in your code, then set the value of this other register to this by typing...." sort of thing.

    There seems to be a lot of tribal knowledge in this just to get started.

    My application seems so simple - just counting timers and flipping pins in response to them. Really really simple logic stuff - this PIC is just here to replace a bunch of 555 timers I had feeding into eachother to simplify my board layout - I thought it had to be awful simple and the snips of code I'm seeing all over the forum seem so straight forward, but I'm having a real struggle here just getting out the door.

    I've made various posts here on the forum all justs trying to get the basics - I've gotten a couple of responses and I thank you all so much for that, but I hope someone can break it down a little further, or point me to other references. I'm more than willing to do the leg work - i just can't find the references.

  2. #2
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default OK from the start ....

    Burning power regulators and smoke is usually not software related. A PIC can usually drive or sink 25 mA and that is not enough to create that kind of events.

    So to make it easier for us to try to help you please post a schematic so we can see what you are up to and figure out where the amps go.

    DO NOT GIVE UP!!!!!!!! it is hard, very hard in the beginning but there is light in the end of the tunnel. All those cryptic names are just names for different registers in the PIC. Usually PBP takes care of them but sometimes you need some manual fixing to get it right. There is no easy way to learn PIC and PBP that I know of, but this forum is worth both gold and diamonds.

    What kind of powersupply did you hook up the poor innocent 3V regulator to? 24V??

    So a simple drawing with partnumbers and some lines going here and there and I am sure many people will join in trying to help.

    /me

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Jumper is correct, need to see how you have it hooked up. As for the code, looks "OK", but if I remember this device needs the OSCON reg set also. If someone does not clarify this I will when I get back to the shop.

    In the mean time look at these.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    http://www.picbasic.co.uk/forum/showthread.php?t=551
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Replies: 10
    Last Post: - 2nd May 2009, 07:42
  2. trouble with my 16f84a
    By cavity creep in forum General
    Replies: 26
    Last Post: - 2nd December 2008, 23:33
  3. ADC conversion trouble
    By PICante in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 30th April 2008, 20:42
  4. MCLR causing trouble . .
    By shahidali55 in forum General
    Replies: 10
    Last Post: - 21st December 2007, 12:20
  5. 16f876 PortA set-up trouble?
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2006, 19:31

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