Viewing 6 reply threads
  • Author
    Posts
    • #2837
      jayeshter
      Participant

      HI SIR,  i uploaded header afile , c file and circuit please look over it

      Attachments:
      You must be logged in to view attached files.
    • #2844
      Bitahwa Bindu
      Keymaster

      I said you must upload the full zipped project so that I can build it on my side. not individual files. Zip the whole project directory. including the image of your circuit diagram.

    • #2846
      jayeshter
      Participant

      hi sir. i am uploading the full zip file..

      Attachments:
      You must be logged in to view attached files.
    • #2849
      Bitahwa Bindu
      Keymaster

      Here are your error:

      1. In the header file: newxc8_header.h you define the frequency as 160MHz (#define _XTAL_FREQ 160000000) if you are intending to use 16MHz, delete one zero.
      2. In your main C file: newmain.C you are defining again the configuration bits. Why? other you delete the header file and configure everything in the main C file or you delete #pragma config in main C because you have done already in header file.
      3. In your main C file: newmain.C why you are defining again the frequency? because you hav edone so already in header file. And you are defining it again wrong: #define _XTAL_FREQ 1600000008 is 1.6GHz not 16MHz. You must be careful with your zeros.
      4. You must include the header file in your main C file. write this code on top of your main file: #include “newxc8_header.h”
      5. The delays you used are for 8MHz like in our example, you must calculate for 16MHZ. Write these delays in your code:void DelayFor18TCY( void ) //18 cycles delay
        {
        Delay10TCYx(20);
        // Nop( ); Nop( ); Nop( ); Nop( ); // 18 cycle delay
        //Nop( ); Nop( ); Nop( ); Nop( );
        //Nop( ); Nop( ); Nop( ); Nop( );
        //Nop( ); Nop( );
        //return;
        }

        void DelayPORXLCD (void) // Delay of 15ms
        {
        Delay1KTCYx(60);
        // __delay_ms(15);
        }

        void DelayXLCD (void) // Delay of 5ms
        {
        Delay1KTCYx(20);
        // __delay_ms(5);
        }

    • #2850
      Bitahwa Bindu
      Keymaster

      Please find attached a working project:

       

      Attachments:
      You must be logged in to view attached files.
    • #2852
      jayeshter
      Participant

      HI SIR, i have modified the codes as per you said. i added header file in the main c file.and clock freeq changed and defined in header file.then also its not working . and i even changed the pic and lcd displyay. something went wrong here. i could’t find it. i am sending the modified full zip file here. can you please heck it? i am sending the pic of lcd display as well

      Attachments:
      You must be logged in to view attached files.
    • #2856
      Bitahwa Bindu
      Keymaster

      You clearly did not follow the instructions.

      1. Set correctly the oscillator frequency as explained. You are still setting it to 160MHz instead of 16MHz.
      2.  make sure the low voltage programming is set to false as you had it in your first project: #pragma config LVP = OFF // Low-Voltage ICSP Enable bit (Low-Voltage ICSP disabled)
      3.  Your delays, change  void DelayFor18TCY( void ) //18 cycles delay
        {
        //Delay10TCYx(20);
        Nop( ); Nop( ); Nop( ); Nop( ); // 18 cycle delay
        Nop( ); Nop( ); Nop( ); Nop( );
        Nop( ); Nop( ); Nop( ); Nop( );
        Nop( ); Nop( );
        return;
        }

      to

      void DelayFor18TCY( void ) //18 cycles delay
      {
      Delay10TCYx(20);
      }

      You can see we commented out all the nop statements.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.
Select your currency
ZAR South African rand
EUR Euro