Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Generating sound with PIC

Home Forums MikroC Pro for PIC Tutorial Discussions Generating sound with PIC

This topic contains 1 reply, has 2 voices, and was last updated by  Bitahwa Bindu 1 week ago.

  • Author
    Posts
  • #3919

    severus snape
    Participant

    I wrote the code which is in the image below for pıc18f2220 and it says undeclared identifier ‘ANSELC’ in expression.Can you send the schematic proper for this code

    Attachments:
    You must be logged in to view attached files.
  • #3921

    Bitahwa Bindu
    Keymaster

    The PIC you used in mikroC project is PIC16F887, not PIC18F2220.

    You have a lot of mistakes in your project. It always good to try and understand the code instead of copy and paste.

    • First, you used PIC18F2220 in Proteus schematic but used PIC16F887 in mikroC.
    • In mikroC you selected to use an external oscillator (HS) but in Proteus there is no oscillator. It won’t work.
    • You enabled the MCLR pin in mikroC project, but unconnected in Proteus, the Project will keep on resetting.
    •  Why do you need ANSELC = 0;  on PORTC while you are connecting nothing to it? Did you read the comments?
    • Not all PIC have ANSEL register to disable analog functions on PIC. For this PIC, you can use ADCON1 register. See page 212 of PIC18F2220 datasheet.

     

You must be logged in to reply to this topic.