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

pic16f877a in Proteus 8

Discussion in 'Microcontrollers' started by Mohamed_Othman, Mar 13, 2018.

  1. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    Dear Friend
    kindly i hope you inform me about what mean that error in picture attached , i am beginner in Proteus 8 ,

    how to connect pic16f877a in Proteus 8 , what is wrong ?
    after i am build program and save it as hex file , and upload file to micro controller , when run simulations not work

    [​IMG]



    [​IMG]

    file in attachment you see copy of picture and file of circuit from proteus 8

    regards
     
  2. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,805
    Likes:
    958
    Location:
    Rochdale UK
    Your code is calling a location that isn't valid.

    Post your code..
     
  3. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    which code you mean ? was written script in Micro C ?
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,805
    Likes:
    958
    Location:
    Rochdale UK
    Can you show me the "script"..
     
  6. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    void main() {
    trisb= 0b000000000; //portb is output , program port b is output
    portb=0 ; // all leds is off
    for ( ;; ) {
    portb= 0b00101011 ;
    delay_ms (10000) ;
    portb = 0b11010100 ;
    delay_ms(10000) ;
    }
    }
     
  7. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,805
    Likes:
    958
    Location:
    Rochdale UK
    Okay... Uncheck all the libraries in the library manager.... I don't think you need any for that code..
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    So what can i do now
    I want knowk where is mistakes k or wrong in n my circuit can you explain by screenshoot
     
  10. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,805
    Likes:
    958
    Location:
    Rochdale UK
    There is nothing wrong with that code...
    The error window in Labcenter Proteus shows you have a pic location violation!!! MikroC is compiling the hex file wrong.

    In MikroC make sure all the libraries in Library manager are unchecked... Also make sure the project is set for a pic16f877..
     
  11. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    can you explain to me by screen shoot , hoe can i fix hex file from Micro C ?
     
  12. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    whats wrong in this script

    void main() {
    char x;
    trisb=0 ;
    portb= 0;
    for ( ; ; ) {
    portb=0b0 ;
    delay_ms(1000) ;
    for (x=0 ; x<<8 ;x++ ) {
    portb=portb<<1 ;
    delay_ms(1000) ;
    }
    }
    }
     
  13. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    what mean that error ? and how can i fix it ? [​IMG][/url] get a photo url[/IMG]

    [​IMG]
    get a photo url


    [​IMG]
     
  14. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,720
    Likes:
    422
    Location:
    Brisbane Australia
    What is PIC168771 as you appear to be trying to compile for it. See line 9 of above image.

    Mike.
     
  15. Mohamed_Othman

    Mohamed_Othman New Member

    Joined:
    Mar 13, 2018
    Messages:
    8
    Likes:
    0
    PIC 16F877A as available in program , how can i fix this error ? what mean of it ? what must i am looking too , when found that error
     
  16. Ian Rogers

    Ian Rogers User Extraordinaire Forum Supporter Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,805
    Likes:
    958
    Location:
    Rochdale UK
    It's a Proteus thing... The correct part is modelled... That is the library part

    I have now a copy of microC and compiled your code and run in Proteus... No problem at all
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice