Connect with us

programming PIC16f877 using all-11

Discussion in 'Electronic Design' started by shehry, Dec 2, 2005.

  1. shehry

    shehry Guest

    hi,

    i cant seem to be able to burn my code properly (i am not sure but i
    think that this is the problem). i used pcwh pic c compiler to write my
    code, which does nothing but turn a few ports on. i compiled the code
    and used waccess software with all 11 programmer to burn the hex file
    generated.

    now this is where i think the trouble seems to come in. when i try to
    load the hex file in to the buffer i am prompted to select the file
    format and i have the following options:

    1. Binary
    2. Intel Hex
    3. Motorola S Record
    4. PICES HEX
    5. 8Bits INHX8M
    6. 16Bits INHX16

    i used pices initially, but it didnt work. then i tried all the rest of
    them. it didnt work.

    can anyone help me in this context. i am attaching the code too
    although its just a test:

    #include <16F877.h>
    #device *=16 ICD=TRUE
    #fuses HS,NOWDT,NOPROTECT,NOLVP
    #use delay(clock=12000000)
    #use rs232(baud=9600, xmit=PIN_B0, rcv=PIN_B1)

    void main()
    {
    set_tris_c(0x00);
    set_tris_d(0x0f0f);
    delay_ms(10);
    output_d(0x79);
    output_high(PIN_A0);
    while(1)
    {
    printf("helloooo dolly");
    delay_ms(1000);
    output_c(0xaa);
    }
    }
     
  2. Just out of curiosity, what kind of object file (8-bit hex, 16-bit hex
    or binary) have you asked your compiler to output?
    <snip>

    I'm not familiar with CCS, but this looks like it might have problems.
    Why 12 bits for the TRISD register, for example?

    Didn't the compiler vendor supply a known-working blink an led "hello
    world" demo program?


    Best regards,
    Spehro Pefhany
     
  3. PCWH, can develop both 8 and 16 bit file formats. In your main screen,
    select 'options', 'file formats'. The screen displayed sets the hex output
    format, in the tick boxes at the top right. The 16bit format, is the
    normal one, and is the format referred to above as 'INHX16' (Intel Hex
    extended 16bit), while the 8bit format is 'INHX8'.
    There are quite a few 'comments' about the example code though.
    The file to be programmed, will be called 'filename.hex', where
    'filename.c' is your source code name.
    You are setting the TRIS registers, but the compiler _by default_, will
    run in 'standard IO' mode, where it generates TRIS controls as ports are
    accessed. If you want to use TRIS yourself, select 'fast_io' for the ports
    concerned. Look in the manual for this.
    You are setting 'ICD=true'. Beware. If you do not have the ICD control
    pins properly loaded, this will stop the chip running.
    Are you sure your crystal is suitable for the chip?. If your chip has
    a -04 suffix on the part number, it is a 4MHz part, and though these will
    operate up to 10MHz on higher supply voltages, these do not support 12MHz.
    Have you got MCLR pulled up to 5v?.
    Have you got both supply connections made?. The chip does need them.

    Best Wishes
     
  4. I'm almost sure that pcwh produces intel hex format.
    You should be able to see "helloooo dolly" somewhere in
    the hex dump window of your programmer software. If not,
    you loaded it with the wrong file format for sure.
     
  5. shehry

    shehry Guest

    thanks a lot to all of you...especially to you roger. you removed some
    of my confusions concerning the tris register. but this time actually
    the problem was something else. i accidently inserted a 330pf capacitor
    instead of a 33 pF one :( .

    thanks a lot to the rest of you too...you're all great :)
     
  6. Those zeros, are sent to get you!....

    Best Wishes
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-