Modifying the code of AN718 to work for a PIC16F877

Discussion in 'Embedded Systems and Microcontrollers' started by DawnAA, Apr 5, 2011.

  1. DawnAA

    Thread Starter New Member

    Apr 5, 2011
    Hi Everyone!

    Im a 3rd year student and I am doing my project.
    My project is to control the speed of the motor using the PIC16F877 and the PICDEM ICD2. I am really new in programming and PIC enviroment.
    So I would like first to change the code of the AN718 that is found in:

    and make it work for my PIC16F877. The AN718 is using a PIC17C756A.

    It will be very much appreciated if anyone can help me on that.
    Thank you very much.
  2. Markd77

    Senior Member

    Sep 7, 2009
    It's written in C so could possibly be recompiled fairly easily. I don't know much about C so can't help with that.
    The main problem is that the PIC17 has a 8X8 bit hardware multiply instruction which takes 1 instruction cycle. It seems to be fairly heavily used and the fastest it can be done on a PIC16 chip is about 35 instruction cycles. This means you would have to make some modifications to allow for it.
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    As for a starter I would say you are one internal timer short. So a direct porting can not be done. I found this information in table 1 in AN718 and stoped reading at that point. The tip I can give you is to use AN718 as a reference. Then use what you have picked up at school to supply the rest. And then if you have problem please feel free to seek help in this forum for a push in the correct direction. But you must put in some effort your self in order to get help.
    Try to split your project up in several isolated sub tasks. Then start solving task you feel most comfortable with. Do not try to solve all problems at once.