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

Programming the PIC16F877 in c++

Discussion in 'Microcontrollers' started by RawTechie, Jun 2, 2003.

  1. RawTechie

    RawTechie New Member

    Joined:
    May 29, 2003
    Messages:
    9
    Likes:
    0
    Hi, i've got the MPLAB installed and i was hoping someone here can help me figure out how to code the PIC program in c++. Actually, if someone can how me how to code a recursive function in asm that would do as well. because the only reason why i want to use c++ is that i don't know how to code a recursive c++ function in asm. thanks!
     
  2. kinjalgp

    kinjalgp Active Member

    Joined:
    Oct 28, 2002
    Messages:
    1,851
    Likes:
    3
    Location:
    INDIA/USA
    I guess you mean "C" and not "C++" the major difference being "C++" facilitates objects oriented approach while its predecessor does not. And till date very few "C++" has been developed for microcontrollers. If you want to work with objects then try for "OOPIC" microcontrollers.

    What exactly do you mean by recursion? Do you mean iterations? Like for-loop or some recursive maths polynomial stuff?
     
  3. RawTechie

    RawTechie New Member

    Joined:
    May 29, 2003
    Messages:
    9
    Likes:
    0
    oh right, thanks. i don't really need the object oriented approach, its just that i've used c++ before that's all.

    anyway, what i meant by a recursive function is a function that calls itself e.g.:

    function factorial(n)
    if n=0 then result:=1
    else result := n*factorial(n-1)

    so the result of the above function is the factorial of the number n..i hope i got that function right..i was just doing it off the top of my head..i hope u get the idea of what i'm trying to do.

    well..are there any programs which will convert a C program into assembly language so that I can just program the PIC16F877 in C? i've really cracked my head trying to figure out how to program a recursive function in assembly language. TIA!
     
  4. dave

    Dave New Member

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


     
  5. Stardus

    Stardus New Member

    Joined:
    May 20, 2003
    Messages:
    5
    Likes:
    0
    Location:
    Belgium

    :wink:

    Hi, if you will use C language in conjuction with a PIC, there is some goodie for you on the net. At site below you'll find a free C pic compiler.

    http://www.htsoft.com/ named PICC lite

    Hopely usefull
    Stardus
     

Share This Page