Announcement

Collapse
No announcement yet.

sys_Sleep and sound object conflict?

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

  • sys_Sleep and sound object conflict?

    Hello,
    I'm using a workshop IDE pro version and I'm controlling a gen4-ulcd touchscreen through an arduino uno. I want to put the touchscreen in sleep mode using the function sys_sleep. I'm also using a buzzer to play some wav file. The problem is that when the touchscreen go in sleep mode the buzzer play a continous acoustic signal. Instead if I delete the sound object in the arduino sketch the sleep mode work without problem. I'm not using the sound object during the sleep mode so I don't understand why I have this problem.
    Can anyone help please?

  • #2
    Hi kopa, welcome to the forum.

    if I delete the sound object in the Arduino sketch
    Did you play the wav file using the Arduino or display?

    Also, if I may, can you provide here your codes (WS4 and Arduino ) as well as the hardware setup? I will try to simulate your project and hope to offer you solution soonest once I fixed the problem.

    Best regards,
    Vince_4D

    Comment


    • #3
      Originally posted by Vince_4D View Post


      Did you play the wav file using the Arduino or display?
      I play the wav file using the Arduino.

      In the attachment file there are all the codes and the hardware setup. They are not the real codes but an easy program I'm using to test the problem.

      Attached Files

      Comment


      • #4
        Hi kopa,

        I tested your code in a display with Gen4-MOTG-AC2 (contains built-in speaker). I didn't experience the acoustic signal that you said when the display goes to sleep and I think it is due to the design of the audio amplifier circuit.

        But try inserting "snd_Stop()" as shown in the code below, this might fix the problem.
        The command will ensure no sound be played when the display goes to sleep.

        This is located on MagicCode1 in your WS4 project.

        Code:
        if (t==0 && counter==15) //15 minute
                counter:=0;
                seroutCS(REPORT_MAGIC_EVENT_BYTES);
                seroutCS(0);
                seroutCS(1);
                seroutCS('S');
                seroutOcs();
                snd_Stop(); // inserted command
                pause(50);
                sys_Sleep(65535);
                pause(50);
            endif
        Hope this will help.

        Best regards,
        Vince_4D

        Comment


        • #5
          Thanks for the reply.

          Originally posted by Vince_4D View Post

          But try inserting "snd_Stop()" as shown in the code below, this might fix the problem.
          The command will ensure no sound be played when the display goes to sleep.
          I insert the code you write but I'm still having the same problem
          This problem is really strange because if I play the sound (clicking on the button) for at least one time when it go to sleep mode I have the problem instead if I run the code letting it goes to sleep before playing the sound it work perfectly..

          Comment


          • #6
            Hi kopa,

            May I ask how you connected the buzzer to the audio output pin?

            The probable reason that I did not encounter the noise signal you experienced is due to the audio amplifier circuitry in gen4-MOTG-AC2. Below is the circuit implemented on the device in processing the audio signal.


            Click image for larger version

Name:	MOTG.PNG
Views:	1
Size:	94.7 KB
ID:	64427



            You can refer to this link, https://www.4dsystems.com.au/product...heet_R_1_1.pdf, for the whole schematic diagram of the device.

            But if you want to use a buzzer, try implementing the circuit as shown below.

            Click image for larger version

Name:	buzzer.png
Views:	1
Size:	17.0 KB
ID:	64428




            Hope this will help.

            Best regards,
            Vince_4D

            Comment

            Working...
            X