1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

compiler for c

Discussion in 'Microcontrollers' started by Dr_Doggy, Dec 28, 2011.

  1. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37
    yea, i get it now, When i read it in the book i thought it meant comparison as in ascii(1)=binary(1), lol

    I am down to the last 3 subroutines now, however i am running in to a problem with my INITALISE sub where I am doing several loops within each other,

    however when my BLOCK value is an EVEN number it never seems to output a 1, I have even /*REM'ed*/ the original line in case2, and added an "override if" statement before the SWITCH line, however dataout never seems to be 1?

    I think the problem is in this sub since i tried preloading the external eeprom in cow, and it is able to "playback" fine in mplab

    (subs READYCHIP and INSTRUCT are "chip select" AND "send instruction" for my external spi eeprom)


    ALSO one other question about Delay10TCYx; IF Delay10TCYx (60) = 50us @48MHz, does that mean ima use : Delay100TCYx(20) TO GET 100us@8Mhz??



    EDIT: in my c code the (IF block==2) is BEFORE the switch begins, i just pasted it wrong in the notepad..
     
    Last edited: Jan 21, 2012
  2. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37
    Im just going to continue on this thread:

    since earlier on in this thread (PAGE2) DerStrom8 mentioned that i needed to go to PROJECT-->BUILD OPTIONS-->MPLINKER--> USE ALTERNATIVE SETTINGS-->>

    /m”$(BINDIR_)$(TARGETBASE).map”/w/p18F4620/o”$(BINDIR_)$(TARGETBASE).cof”

    however i have upgraded the chip in my demoboard to an 18F2550, i changed the header, linker and #pragma accordingly, i also changed the line above to:

    /m”$(BINDIR_)$(TARGETBASE).map”/w/p18F2550/o”$(BINDIR_)$(TARGETBASE).cof”

    however i am getting that "device not specified use /p option" error again, he(you) also mentioned maybe doing deeper resarch on this, maybe you can check on this chip? and/or show me what/how to research this since I also will be using a 18F1230 in the near future?
     
  3. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Hey doggy :)

    May I ask again what version of MPLAB you are using? I can't remember why I had you change the MPLINKER settings. In the newer versions of MPLAB, I think they set them automatically.

    Another question: When you started the project, did you use the project wizard? You should be asked to select a processor as one of the first steps, and I think that's what the rest of the wizard uses in order to set up your project correctly. Sorry for my poor memory--I seem to have been losing my mind lately ;)

    Der Strom
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37

    mplab is ver 8.36

    um mplinker v3.40

    also i ensured to set the first step in wizard, but it is good to be through here, i did need to double check that.
     
  6. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    8.36 is quite old. Personally, I'd recommend you create backup files for your current MPLAB projects and install a newer version. I believe they're up to MPLAB 8.84. You can download it here. Just scroll down to the bottom of the page where it lists the downloads, and find MPLAB v8.84. I believe that includes the linker and everything, so you don't need to set it up separately. It will make your life a whole lot easier! :D

    Good luck!
     
  7. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37
    OK so i got it up on the PC, however im not sure how to set up my clock mode, it is saying that it doesn't recognize OSC
    in program mode i think this is why its not working,

    however i am running in to another problem in debug where its saying that error "5v is applied but 0v response"
    programming verifies ok,
    this is all on the demoboard.

    (cow works)
     
  8. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Hmm, not sure about the error one. I haven't seen that before. All I can think of is to check your power connections. Now I forget--are you using a PICkit or a different programmer? If you're using the PICkit, set it to supply power to the chip, rather than an external source.

    As for the OSC settings, check the datasheet for the chip/board. It may differ from chip to chip, board to board. The settings may look different, so the datasheet should help you with that part.
     
  9. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37
    ya, its not the setting i dont think, its the whole definition of OSC that it does not like, iv tried all the internal settings on the list before i realized that it said definition OSC.
    (error1224 configuration setting 'OSC' not recognized)


    pickit2, and a demoboard i got with it, had leds on b0-3 and a button and pot,
     
  10. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Okay, please excuse my repeat questions, but which compiler did you end up using? If you're using C18, you'll need to set the OSC in the #pragma config line. If you're using Hi-Tech for PIC18s, I think you'll have to do a __config(....). Perhaps somebody else can verify this?

    If you define the OSC in the wrong way or place, it will not recognize it. Also, it will differ from compiler to compiler. "OSC" may not be the right abbreviation. Check the compiler's libraries for the oscillator settings--they should tell you how to set it up.

    Good luck! :D
    Regards
     
  11. Dr_Doggy

    Dr_Doggy Well-Known Member

    Joined:
    Aug 11, 2007
    Messages:
    1,715
    Likes:
    37
    oh, ya sry, C18_v3.40, same file as on the old mplab, but OSC=INTIO67 didnt work, so then i went to the datasheet and used the ones there without success,

    this pic may be unique, since i just discovered internal usb on it, which may be problematic? but i notice on my 28pin pics that generally the pins line up, ie portb0, b1, b2... is same on both,r



    EDIT: reading @mplab.com says that the debug connect error is related to the clock mode, if im reading the datasheet correct im using INTIO
    18F2550..

    edit2!: i got the thing running in cow, wher OSC=INTOSC_EC, but still same problem with mplab, could it be a bad h or lkr file, is there a place to get updates for these files?

    on a side note, i also wonder how to use this usb thing, would there happen to be an example of the handshakes & protocols involved?
     
    Last edited: Mar 11, 2012

Share This Page