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

PIC-Programmer 2 for PIC16C84, its software & compiler???

Discussion in 'Microcontrollers' started by hassankhan, Jan 25, 2012.

  1. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
    just few mins before i saw there is just 0.27 volts drop across led,what is it?plz tell


    regards
    Hassan
     
  2. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    Measure voltage at the port in wrt Gnd, instead of across the LED. perhaps the port pin output is Low at that moment.
     
    Last edited: Feb 2, 2012
  3. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    The code I posted the delay may not be long enough to see it blink here new code shows how to use delay_ms
    Code (text):

    #include <htc.h>
        __CONFIG (FOSC_HS & CP_OFF & WDTE_OFF & PWRTE_ON );
    #ifndef _XTAL_FREQ
     // Unless already defined assume 4MHz system frequency
     // This definition is required to calibrate __delay_us() and __delay_ms()
     #define _XTAL_FREQ 4000000
    #endif
    void init(void)
    {
    // port directions: 1=input, 0=output
    TRISB = 0b00000000; //set's portb to output
    RB0 = 0;  //starts RB0 off
    }
    void main(void) //main code atfer here
    {
    init(); //runs startup code
    while (1){  //loop
    RB0 = 1;    // turns led on
    __delay_ms(1000); //delay
    RB0 = 0;      // turns led off
    __delay_ms(1000);  // delay
    }
    }
     
    Here the hex to just in case your doing something wrong you can try it to see it work
    Code (text):

    :02000000D62BFD
    :1007AC008301DD2B83168601831206100800D823E3
    :1007BC00DF2B8312061406308E0013308D00B130FF
    :1007CC008C008C0BE72B8D0BE72B8E0BE72BEE2B7A
    :1007DC008312061006308E0013308D00B1308C0061
    :1007EC008C0BF62B8D0BF62B8E0BF62BFD2BDF2BA0
    :0407FC00DF2B0028C7
    :02400E00F2FFBF
    :00000001FF

     
     
  4. dave

    Dave New Member

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


     
  5. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1

    when i compiled your code & loaded the hex file into the winpic800,the screen i got is given below plz tell me did i compile & load hex file correctly.
    View attachment 60796



    regards
    Hassan
     
  6. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    sorry.
    there is nothing on that screen. all 3FFF, Probably while selecting the hex file you did not give p[roper routing. please check where is the hex file located, after compiling?
     
    Last edited: Feb 3, 2012
  7. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    He not doing something right looks like he didn't load any thing but a blank.?
     
  8. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    yes Burt, perhaps lack of understanding on the process. Hope that he would realise the process sooner.
     
  9. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    I no the code works I dug out a old board with a 16f84 on it and tried it. Just to make sure and it worked in MPLAB sim.

    I would keep my files at C:\ Mycodes so you can find it Mycodes being what ever you want to name it if your running XP.
     
    Last edited: Feb 3, 2012
  10. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
    now from start i m telling what actually i did. I took burt code and place on mplab & saved it in d: then i selected new project & then gave it a place in d: & then selected Hi-tech compiler and then start doing work.I selected my saved file in other files option & compiled it & then exported the file & selected file format named intel 32 bit hex (INHX32) & then saved in d: & then opened winpic800 & loaded the file which i exported & that was with the extension of HEX,now plz tell me where was the mistake.



    regards
    Hassan
     
  11. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    You don't export any thing When you compile the file with MPLAB it makes a HEX Like the one I posted for you I'm going to zip up my files all you have to do is download them and unzip them
    where you want them. Then use winpic800 to load the hex it's called blink84.hex

    You can open the mplab project file and MPLAB will open it just Like I did it But just try to load the hex thats in it
     
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    That picture you posted is not on a XP computer
     
  13. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
    yeah actually my xp pc is not working properly for net then i took picture from that pc & send it by my laptop and edited on win7 thats y.
    now tell me plz
     
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE
    Did you unzip the file I posted ? try to use the hex in it
     
    Last edited: Feb 4, 2012
  15. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    please locate the hex file created recently.
    zip and upload it let us examine, Hassan saheb !!

    i believe the code should be in intel 8 bit hex format
    you machine is 32 bit, but 16F84A micro-controller can't manage 32 bit !!
     
    Last edited: Feb 4, 2012
  16. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
    Burt i loaded that file on winpic800 the picture i got,is given below,plz tell me is it fine?

    View attachment 60798
     
  17. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
  18. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    i fear, Mr Hasan, you are not =understanding the issue.
    the PIC16F84A ids an 8bit mid range microcontroller
    the data sheet would indicate that you have to seek from the compiler, Intel HEX8 and not intel hex 32.

    use burt's hex and as you go down the window of winpic800\ the code is seen at the last. in your file the code is not seen at the same or no other location.
     
    Last edited: Feb 4, 2012
  19. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
    yeah i know that but the problem is that if i select intel 8 bit then it forms two splitted files with extension of HXH & HXL,then what should i select in winpic800?
     
  20. hassankhan

    hassankhan New Member

    Joined:
    Jan 24, 2012
    Messages:
    65
    Likes:
    1
    yeah i found something in the last when i used burt's code in winpic800 & i have programmed by that, is it fine now?
     
    Last edited: Feb 4, 2012
  21. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    ONLINE

    That's how it looks when I do it You got it working
     
    Last edited: Feb 4, 2012

Share This Page