PIC18F got some weird problem?


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40

    Default PIC18F got some weird problem?

    Hi everyone,

    I gotta some problem with blinking my PIC18F452, which the version of PBP is 2.47 and with the latest MPASM.I changed the INC file a bit ( HS_OSC )and thats all.Is the problem could be the capacitor (0.1uf) that should be placed in the ICSP programmer(I use EPIC) which is near the header or some other thing.Below is the code :

    (BACK TO BASIC)

    Define OSC 16

    TRISA = %00000000
    TRISB = %00000000
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %00000000



    Led_1 var PORTB.0
    Led_2 var PORTB.1


    low Led_1
    low led_2



    start:


    high led_1
    pause 500
    low led_1


    goto start


    and the INC file:

    ;************************************************* ***************
    ;* 18F452.INC *
    ;* *
    ;* By : Leonard Zerman, Jeff Schmoyer *
    ;* Notice : Copyright (c) 2005 microEngineering Labs, Inc. *
    ;* All Rights Reserved *
    ;* Date : 12/16/05 *
    ;* Version : 2.47 *
    ;* Notes : *
    ;************************************************* ***************
    NOLIST
    ifdef PM_USED
    LIST
    "Error: PM does not support this device. Use MPASM."
    NOLIST
    else
    LIST
    LIST p = 18F452, r = dec, w = -311, w = -230, f = inhx32
    INCLUDE "P18F452.INC" ; MPASM Header
    __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    __CONFIG _CONFIG4L, _LVP_OFF_4L
    NOLIST
    endif
    LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 8
    .................................................. .................................................. ....

    So what could be the problem?.....

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    there's one line missing...
    Code:
    high led_1
    pause 500
    low led_1
    pause 500
    
    goto start
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40


    Did you find this post helpful? Yes | No

    Default But..

    Thanks a lot steve,doh!!..i tried i many times but sometimes get rush!!

    But steve,sometimes it doesn't work?.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    When you say sometime it doesn't work... what do you refer to?
    programming or the blink?

    make sure you have set the EPIC software to program the config fuses. I know there's an option somewhere.

    when you program it, make sure you (or the programmer) tie/load the PGM pin to gnd.

    and the usual, Both VSS and VDD connected, 0.1 uF close to the PIC, MCLR to Vdd.

    No loose connection between the PIC and the crystal+Caps. And short distance between the PIC and the crystal.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40


    Did you find this post helpful? Yes | No

    Default resets itself

    I also found that it resets itself.Could it be the perfboard problem?.

    I just made SPI work between 2 PIC ( 18F452 & 18F458 ).It worked but sometimes,it resets and return to main loop although i had set BOR to lowest and make PWT enable + placed 2 npo 7 multilayer ceramic and 2 tantalum cap as near as possible to PIC.The Vreg uses LDO with good quiecent current which i belive would handle load very well.So why sometimes it resets itself?

  6. #6
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40


    Did you find this post helpful? Yes | No

    Default as above

    The software part.It sometimes reset itself.I face no problem programming it as i do play with the fuses cuz sometimes you need to activate PLL and so on.So no problem with programming.Everything is ok.But,i face no idea why it don't want to for example:blink a led every 1 second..it's no "go".Maybe i spent so much time on CCS...hehehe...

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Without the whole code and schematic it's hard to say...
    Stack-Overflow reset?
    Faulty MCLR contact?
    BAD config fuses programming (LVP_ON could do some strange thing sometimes)
    messy supply line may cause some BOD reset as well
    etc etc etc

    To me scoping the VDD rail to see if it's clean and monitor the MCLR pin would be my first test...

    Well, you could still use CCS to see if the results are the same It have to be!
    Last edited by mister_e; - 17th February 2007 at 17:19.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40


    Did you find this post helpful? Yes | No

    Default so..

    So,you belive this problem nothing to do with the EPIC programmer nor the software,that would be PBP version 2.47.My first thought is that the problem might come from the EPIC programmer as it was stated in the melabs website recommending a 0.1 uf cap between the power line?.Is that really neccessary?.I don't face any problem with the programming.So it's 50-50 in my mind.

    Actually , i made this circuit in perf board(donut board) or point-to-point soldering board with 16mhz crystal and a 4.7k pull-up for mclr.That's all.

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    it's not a PBP problem.. it's working here on an EasyPIC 4 board.

    Is this a EPIC problem.. maybe, i don't have it. And yup the Cap while programming should help. And yup always plae one close to your PIC and, at least, close to all other IC. I always place a 10uF tantalum close to the PIC too.

    Which capacitor value did you use around your crystal?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40


    Did you find this post helpful? Yes | No

    Default thats..

    I use 22pf npo 7 grade cap.Mmm..it's fine..

    Hey,you mentioned about the stack overflow right.Mmmm..Does that always come in a way to this sort of problem.I don't think so.I always set LVP off as this is not the "J" type PIC.

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    F... weird. Did you also erase the PIC before programming it?

    Once programmed, read it back, and look the config fuses haven't change to something else.

    There's some days like that...

    Did you also tried to program your PIC in circuit?

    I always set LVP off as this is not the "J" type PIC.
    Sorry but it has nothing to do with the J type... or, HEHE i misunderstood something awhile back
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Do you leave the Epic plugged into the board.

    With mine, if I turn on a fluorescent light nearby, it'll reset the PIC.
    If it's unplugged, it doesn't happen. But normally I just leave it plugged in and ignore the resets.

    Also had a screen saver that does something to the parallel port when it activates. It resets the pic too. Stopped using that screen saver.
    <br>
    DT

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I already heard some strange stuff... but a screen saver that poll the parallel port

    So their XP printer polling PATCH didn't solved the problem?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Join Date
    Jun 2005
    Location
    Penang
    Posts
    40


    Did you find this post helpful? Yes | No

    Default Alright!!

    Hey yo steve and darrel,

    It's working.I add some config on the inc file (STACK OVERFLOW & LVP OFF)(and that's weird too why that thing come in my way?) and it's working.So do goes for the SPI.It never jump to main loop this time.Thanks a lot guys.I safely blinked the LED'S this time.Talk about screen saver polling LPT's,geee..that's freaky.Lucky for me,i disable screen savers as i hate one =>.But the flourescent,is that for real?.Cuz i do work or test anything i do with my only one table lamp thats couple of inches away from my project desk.I don't face that kind of problem and especially 'resets' on pic?.Hmm..for sake i gotta bear in my mind.But i face a 50hz distortion ( using fluke dmm) but i knew that's a AC current nearby but i do re-calculate.Beside,the nature of flourecent driver (balast ,starter e.t.c) is more toward crude stuff.

Similar Threads

  1. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  2. Weird code problem
    By Navaidstech in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th March 2009, 11:16
  3. Weird Problem
    By isaac in forum General
    Replies: 9
    Last Post: - 22nd September 2008, 19:30
  4. Weird problem with 12F629
    By martarse in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 28th May 2005, 07:15
  5. weird 12F629/675 problem
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th October 2004, 01:08

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