Can't get a 16F88 to do anything.


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Posts
    7

    Unhappy Can't get a 16F88 to do anything.

    Is there anyone out there willing to give me a code sample that will flash an LED using a 16F88 (code from start to finish including all fuse settings etc.).

    I have worked with lots of PIC's, though mostly the 12F series lately. I started out programming microcontrollers in HEX, then graduated to assembly, and have been using PICBasic PRO for years (currently using v 2.47). I am very familair with them and usually don't have any problems, but this 16F88 is kicking my tail! I have the CMCON, ANSEL, TRIS settings, & OSCCON to what I'm pretty sure are the correct settings (though I have tried a few different settings), but still nothing.

    I have looked over all the similar links and have tried everthing in them and I still can't get a blinking LED from this chip. I always start with a new chip by getting an LED blinking, but I just can't seem to get it. I have spent hours on this! It's got to be some little thing I am missing, but I haven't been able to see it. At this point I am just throwing any piece of code in there.

    So, all I need is some known good code. I don't care which port you put it on or anything, just give me a blinking LED that usies the internal RC oscillator at 8MHz, no comparators turned on, no analog, just digital I/O all all the ports.

    I have tried different chips (3) and different breadboards and different power supply's.

    I am using Microcode Studio Plus as my editor, I then import the file the MPLab like I do with all my other chips. I have set the chip selection to correct one in both Mircode Studio Plus and MPLab. I have tried setting the fuses through the code (which is what I usually do) and manually, neither way has worked for me. My code doesn't spit out any errors (not that it means too much).

    I am stuck! Any help would be greatly appreciated.

    Carl

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


    Did you find this post helpful? Yes | No

    Default

    Welcome,
    Generally we like to have the problem code posted, then we can help you find the problem.
    http://www.picbasic.co.uk/forum/showthread.php?t=1742

    Post #20 in this thread has blinky code
    http://www.picbasic.co.uk/forum/show...ighlight=16F88
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Hi ccowley,
    Welcome to The Forum, let's pretend, just for hoots, that you are a complete newbie, and we are the starving code hungry dogs,<b> I did say we are pretending didn't I ?</b> Throw us some bones of your startup code, maybe a little meat on those bones (a loop or 2 ), a little copy paste of what you have tried . . . and we'll see if you did something wrong, just so you don't have to edit the hex later
    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.

  4. #4
    Join Date
    Aug 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Still not working...

    Hi again,

    Thanks to both of you for your input! I really appreciate the response, but things still aren't working. I did read through the entire thread that was linked to (among others) and tried everything that was suggested. The code snippit below is the from that thread and is the one I have been working with today. I have spent another 4 hours playing with this thing and it just isn't going.

    I have repeated the results with two different bread boards and two different power supplys and I have rotated through 4 diffent chips and get the same results. I have checked my power and ground connection also. I can't remember ever have this kind of trouble with a microcontroller (well, okay, there were a few hairy times back in wirewrap days in college with a certain 6502 chip).

    So, here is the code that I am using:

    OSCCON = %01101110 'set int osc to 4mhz
    'OSCON = %01100000
    ANSEL = 0 'ALL DIGITAL
    CMCON = 7 'COMPARATORS OFF

    TRISA = %00000000 'ALL OUTPUTS
    TRISB = %00000000 'ALL OUTPUTS
    PORTA = 0 'PORTA LOW

    @ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF
    Pause 100 'SETTLE DOWN

    START:
    High PORTA.6 'ON LED
    High PORTA.7
    Pause 1000
    Low PORTA.6 'OFF LED
    Low PORTA.7
    Pause 1000
    GoTo START 'REPEAT FOREVER

    end

    I have also tried it with the edited INC file and unedited INC file as mentioned in the other thread, but it doesn't change anything.

    One odd note is that RB5 is always a constant 5V on every chip that I have tried so far (up to 4 now). I checked it with a scope to see if it was a clock signal or something, but it is a solid 5v.

    Thanks in advance!

    Carl

  5. #5
    Join Date
    Jun 2007
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Try this OSCCON

    Hi Carl,
    I usually use
    OSCCON = %01101000 and it seems to work. Don't forget the Define OSC for speeds other than 4MHz.
    Hope this helps.
    Mike

  6. #6
    Join Date
    Aug 2008
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Trying OSCCON %01101000

    Hi Mike,

    Thanks for taking a look at it. I tried the OSCCON value that you suggested and it still didn't work. I am beginning to wonder if it must be a compiler error, but I'm sure I'm not the only one using these that is still on PBP 2.47. I ordered upgrade to PBP 2.50 today just in case, but I'm not conviced that's the answer.

    Thanks again,

    Carl

Similar Threads

  1. Code works on 16F84A but not on 16F88?
    By pharaohamps in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th November 2009, 18:29
  2. Output settings for 16F88
    By PICante in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 22nd June 2008, 14:03
  3. 16F88 RA6 and RA7 troubles
    By gandora in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd August 2007, 02:57
  4. 16f88 help
    By ccsparky in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd July 2004, 17:50
  5. 4 line LCD with 16F88
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 09:06

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