Announcement

Collapse
No announcement yet.

Touch control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Touch control

    Hi

    Problem with sensitive touch. I use a uLCD-28PT (SGC)

    *It works perfectly with FAT controler : I enable Touch, then draw a rectangle, then put a detect touch region on this rectangle, then use get touch coordinates and read the answer 0x1 for example when I press the good region. All is good !

    *It doesn't work with a PIC 16F.

    In my program after each command : auto baud, touch enable Feature, draw rectangle and detect touch region, a loop is written. Each loop waits for a 06hex and my program can only follow after reception of this ack. My program works well until the answer of 6F hex command (get Touch coordinates). The end of my program transmits 6F and 04 then my following loop gets a character, puts it in a string , increments a variable and gets another character'

    I trace my program with a debugger and can see that the program can't cross the first reception of a character after 6F and 04' Because there is no answer! Why the PICASO doesn't answer ?

    My loop works well because if I don't write Touch Enable feature (59, 05, 00) in my prog, I really receive (after sending 6f hex and 04) a first character caught in the same loop and it is 06hex (the ACK).

    What's the problem ????

    Best regards
    e="heading 7"/> Exception Locked="false" UnhideWhenUsed="false" Name="Revision"/> ocked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/> 5"/>

  • #2


    Without seeing the code it's hard to tell, can you post it here?
    Mark

    Comment


    • #3


      Thank's for your answer!
      Here's the source code in C:

      #include
      #fuses HS,NOWDT,NOPROTECT
      #use delay (clock=20000000)
      #use rs232(baud=9600, parity=N, xmit=PIN_c6, rcv=PIN_c7, bits=8)

      void main( )
      {
      char ackno, touche=9;
      char reponse[6]; int a=0;

      delay_ms(500); // wait after power up

      do
      { putchar('U'); // Autobaud
      ackno =getch();
      } while(ackno!= 0x06);

      putc(0x45); // clear screen (rÃsolution 240x320)
      delay_ms(50);

      putc(0x42); putc(0x00); putc(0x00); //black screen
      delay_ms(2500);
      putc(0x42); putc(0xff); putc(0xff); //white screen
      delay_ms(2500);

      // --- rectangle en x=(32,48) et y=(96,123) blue one:
      putc(0x72); putc(0x00); putc(0x20); putc(0x00); putc(0x30); putc(0x00); putc(0x60); putc(0x00); putc(0x7B); putc(0x0A); putc(0x1F);
      delay_ms(1000);

      //---- Touch features :-----------
      do
      { putc(0x59); putc(0x05); putc(0x00); // 0x00= enable
      ackno =getch();
      } while(ackno!= 0x06);

      //sensitive bouton: Detect Touch Region - Region = blue rectangle
      do
      { putc(0x75); putc(0x00); putc(0x20); putc(0x00); putc(0x30); putc(0x00); putc(0x60); putc(0x00); putc(0x7B);
      ackno =getch();
      } while(ackno!= 0x06);

      output_high(pin_B1); // LED PICDEM2 card

      //wait for touch: Get Touch Coordinate
      putc(0x6F); putc(0x02);
      while (a

      Comment


      • #4


        You need to wait for the ack/nak for every command.

        You have missed doing it for quite a few, so either a) you will be reading responses to a 'previous' command, or b) you will be effectively sending garbage commands by overrunning the input buffer of the display.
        Mark

        Comment


        • #5


          Ok. thank's
          I though it was possible to only wait a few time for certain command. I'll retry this afternoon with a loop for each command.
          Cordialy

          Comment


          • #6


            I tried with a loop for each command and it works well... if you put also the good delay after each loop. Delay corresponding with the time necessary to make the entire action.
            Thank's very much for your answer!
            Cordialy

            Comment


            • #7


              You look like you are resending you commands in your do while loops ?

              I can see that causing problems if you are

              Comment

              Working...
              X