Madness, 18F2550!


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27

    Default Madness, 18F2550!

    Dear friends, please help or I'll go crazy. This seek simple code doesn't work
    on 18F2550. Of course, it works on good old '876.
    Code:
    @ __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
    @ __CONFIG    _CONFIG1H, _FOSC_HS_1H
    @ __CONFIG    _CONFIG2L, _PWRT_ON_2L
    @ __CONFIG    _CONFIG2H, _WDT_OFF_2H 
    @ __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _PBADEN_OFF_3H
    @ __CONFIG    _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L
    
    define OSC 20
    define LCD_EREG PORTC
    define LCD_EBIT 1
        
    i var byte
    pause 100
    
    lcdout $fe,1,"MADNESS!!!"
    pause 1500
    i=15
    pause 500
    lcdout $fe,1,dec3 i
    pause 1500
    kraj: goto kraj
    end
    when I start pic first time I get value 164 on LCD, and after that every reset
    gives value 004 ?????!!!!! Am I crazy or what? I try different values for i but
    never gets the correct value. I try with i defined as word - the same thing.

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hello,

    Taking a basic stab at your problem I see:

    Where's the rest of the DEFINES for the LCD? Assuming you're using the defaults of connecting to PortA then where are the settings to disable the Analog and converting the A/D pins to digital? You also need to disable the comparator module.

    There's no reason to go MAD, just sit back and relax. Read the datasheet and keep trying!

    BobK

  3. #3
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27


    Did you find this post helpful? Yes | No

    Angry

    Sorry, I forgot to paste that part of code:
    Code:
    @ __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L 
    @ __CONFIG    _CONFIG1H, _FOSC_HS_1H
    @ __CONFIG    _CONFIG2L, _PWRT_ON_2L
    @ __CONFIG    _CONFIG2H, _WDT_OFF_2H 
    @ __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _PBADEN_OFF_3H
    @ __CONFIG    _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L
    
    define OSC 20
    define LOADER_USED 1
    define LCD_EREG PORTC
    define LCD_EBIT 1
        
    i var word
    pause 100
    
    CMCON=7
    CCP1CON=0
    ADCON1=$0F
    ADCON0=0
    
    lcdout $fe,1,"MADNESS!!!"
    pause 1000
    i=150
    pause 1000
    lcdout $fe,1,dec3 i
    pause 1000
    kraj: goto kraj
    end
    but still the same thing, and the interesting fact is that the code
    working OK - the value written on lcd is correct when i program
    pic through bootloader!

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


    Did you find this post helpful? Yes | No

    Default

    For some odd reasons,
    Code:
    LCDOUT $FE,1,#I
    work
    Steve

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

  5. #5
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27


    Did you find this post helpful? Yes | No

    Angry

    I'm very disappointed because I have a huge application which controls
    solar machine and it works great and my customer is very satisfied.
    Because of new features planing to add I have to migrate the whole
    design to 18F. And I am stucked for almoust a month without any success.
    The program is acting very strange - don't react on buttons, don't count time... But when I use bootloader from MCS everything WORKS as expected!
    Of course, my customer have only ICPROG they don't use bootloader so what should I do, start to write the whole application from the beginning in C?????

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


    Did you find this post helpful? Yes | No

    Default Cool down a little bit...

    Well, do as you wish... but i doubt it will solve the problem.

    At least make sure the Config fuses are correctly transfered from MCS to your XYZ programmer software and that your XYZ software is set to program those fuses.

    I'd never trusted ICPROG and ALL freebies one anyways, and guess what? I think it's the main problem here.

    When you don't use the bootloader, how do you program your PIC, In-circuit?, on a ZIFF (or else) socket? Wich programmer/interface. Is PGM tied to GND (or at very least loaded to GND)?

    Did you do a 'programming check' once it's programmed?

    Any schematic of your stuff? ... just in case.

    EDIT: i remind Malc-C already had problem programming this PIC with software like that... no coincidence at all

    EDIT #2 : ICPROG don't have the 18F2550 in it's list... at least if their wonderful website is up-to-date...
    Last edited by mister_e; - 10th February 2007 at 18:49.
    Steve

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

  7. #7
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    I stop using ICPROG when starting using the 18Fxxxx ....
    ICPROG could not understand the EEPROM- or DATA-values.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  8. #8
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27


    Did you find this post helpful? Yes | No

    Talking

    Sory guys,
    my mistake due to hurry, I use WinPic programmer and yes, I checked all fuses that I programmed. The LED blinking program works very well so I think
    that the programmer is doing his job very well.

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


    Did you find this post helpful? Yes | No

    Default Just a question about bootloaders code

    To use a bootloader you add to code
    Code:
    define LOADER_USED 1
    and if I understand what this does correctly, it moves everything down the stack, some fixed size (4 bits, or is it 4 bytes?) anyway, what happens if you forget to comment out this code when not using bootloader?
    If as mister_e says ICPROG doesn't support 18F 2550 it's never going to program it properly.
    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.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tom View Post
    Of course, my customer have only ICPROG they don't use bootloader so what should I do, start to write the whole application from the beginning in C?????
    As a stopgap, you could program chips for him, until you sort this out.
    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.

  11. #11
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Have you tried the 'exact' same config fuse settings that are in your loader file
    when programming it without the loader?
    Last edited by Bruce; - 10th February 2007 at 23:25.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  12. #12
    Join Date
    Oct 2004
    Location
    Zagreb, Croatia
    Posts
    27


    Did you find this post helpful? Yes | No

    Smile Solved finally!

    That helps Bruce!
    By careful comparision of every fuse programmed with and without bootloader I noticed some XINST=Extended Instruction Set Enable Bit which was dissabled in working version and enabled in non working version! In WinPicProgrammer this fuse is called "ENHCPU Extended CPU Enable". This fuse is related with some 18F specific data addressing techniques. To be sure that this fuse is my problem I reprogrammed several times exactly the same program (with other fuses the same) with XINST OFF and XINST ON and YES! With XINST ON the program is acting very strange and completely unfunctional. I try with programmer and with bootloader, symptoms are the same. So, dear friends, thanks everyone for help and write down in your notebook of 18FXXX' secrets following line:
    Code:
    @ __CONFIG    _CONFIG4L, _XINST_OFF_4L
    cheers!

Similar Threads

  1. 18F2550 timing
    By sstt1976 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 22nd August 2008, 00:30
  2. Error compiling 18f2550
    By sirvo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th May 2008, 23:22
  3. 18f2550 + 24lc512
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2007, 22:02
  4. 18f2550 'access is denied' USB error?
    By Giulio in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th December 2006, 14:29
  5. 18F2550 config fuses, is my setup OK?
    By peu in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 28th July 2006, 03:48

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