0

i currently working on PIC microcontroller. I have PIC18F26K40. I want to use CVD (Capacitive Voltage Divider) technique to implement capacitive touch button. I am using mTouch library of MCC (Microchip Code Configurator) library for that. I am doing same as per microchip documentation (links are here and here ). PIC is not detecting the touch. Here is my main method below:

void main(void)
{
  // Initialize the device
  SYSTEM_Initialize();

  INTERRUPT_GlobalInterruptEnable();
  INTERRUPT_PeripheralInterruptEnable();

  LED_TRIS = OUTPUT;

  while (1)
  {
    if(MTOUCH_Service_Mainloop())
    {
        /* Button API*/
        if (MTOUCH_Button_isPressed(0))
            LED_LAT = HIGH;
        else
            LED_LAT = LOW;
    }
  }
}

I have some doubts:

  • What is differential CVD.
  • What is driver shield. Do i need it?
  • Do i need to use two analog channels.
  • I have worked and tested CTMU mode of PIC18F26K22. Is there any way use CVD like CTMU.
  • If you have any solutions with or without library then let me know.

I am attaching some screenshot of my MCC configurations. Please go through it.

Help needed! Touch button description Pin module description System module description

Note:

  • MPlab IDE: v5.50
  • Analog pin used for sensing: RB0
  • Programmer: PICKIT3
  • While embedded systems software questions are on-topic, this one might be more suitable for https://electronics.stackexchange.com/, ideally together with some simple schematic of the circuit. – Lundin Sep 09 '21 at 06:41

1 Answers1

1

I came across your post whilst researching another issue with PIC mTouch on the same MPU you're using (or, rather the low voltage version, PIC18LF26K40). I am also using MPLAB X v5.50 with the mTouch plugin. Just wanted you to know that I was able to set up a single touch button with no problem on this chip, actually compiled and worked on the first try. So, you're on the right track!

You do not need to use the "driven shield" that is presented as an mTouch output (this is for improving signal integrity later when you're concerned about such things, see the various app notes on this). I used the "CS" (capacitive sensor) output only and it works fine.

This video helped me get started: https://www.youtube.com/watch?v=CCW3g9RqpZk

Hope this helps a bit.

Davebert53
  • 11
  • 1