Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:58 17 Sep 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM+ Explore100 Piezo question

Author Message
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 06:54am 30 Aug 2016
Copy link to clipboard 
Print this post

Does anyone know if there is a way to use the GUI graphics commands with an option to sound or silence the Piezo (rather than it sound every time a GUI control is 'touched'.

I do not want to remove the Piezo as I will occasionally want 'clicks' from GUI controls.
I could PWM the Piezo from an I/O pin but this adds more lines of code - something I'm trying to avoid .
Alternatively I may use a single I/O pin to enable/disable the Piezo (I have a spare AND gate that could drive the transistor base).

BUT I was wondering if there was a command/parameter that I have overlooked. Any help, or other ideas welcomed . . . . .

Thanks,
WW
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10400
Posted: 07:35am 30 Aug 2016
Copy link to clipboard 
Print this post

Try these UNTESTED

[code]
Csub buzzoff 'no parameters
00000000
3C029D00 8C420090 03E00008 A0400037
End Csub
'
Csub buzzon 'call with pin number connected to the buzzer
00000000
3C029D00 8C420090 8C830000 03E00008 A0430037
End Csub
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 07:52am 30 Aug 2016
Copy link to clipboard 
Print this post

Thats brilliant - well half brilliant.

The buzzoff() works. But buzzon(39) gives a CPU exception 10 error. At address 0x9D0017C4 if thats any help!

WW
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10400
Posted: 08:04am 30 Aug 2016
Copy link to clipboard 
Print this post

Not for me it doesn't



 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 08:14am 30 Aug 2016
Copy link to clipboard 
Print this post

I get buzzed() to 'switch off' pin 39 from OPTION LIST (as in your screen-shot above), but buzzon(39) restarts the MM every time. This occurs both at prompt and in code.

Triple checked everything. CPU is at 100. v5.2 (as per Geoff's website).
My pins/OPTIONS are slightly different to yours as follows:

DISPLAY 24, 66
LCDPANEL SSD1963_7, LANDSCAPE, 48
TOUCH 1, 40, (39)
KEYBOARD UK
SDCARD 47
LCDPANEL CONSOLE
RTC 67, 66
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10400
Posted: 08:49am 30 Aug 2016
Copy link to clipboard 
Print this post

Can you post a screenshot of exactly the sequence I did above.

You do have the later version 5.2? Geoff did a very minor update after a couple of weeks.

All the CFunction does is change the value of the OPTION location for the buzzer so the difference can only be that the location is different somehow.

UPDATE

Change the subroutine definition to

CSUB BUZZON(INTEGER)

I bet you haven't set the default data type to be integer and it is passing the number as a floatEdited by matherp 2016-08-31
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 09:07am 30 Aug 2016
Copy link to clipboard 
Print this post

  matherp said   Can you post a screenshot of exactly the sequence I did above.[/quote]

Add the word OPTION in front of each line in my earlier post and that is what I have. I am running a standalone E100 system so no-go for a screen shot!

The 39 is in brackets as I have it 'listed' before the BUZZOFF() sub is called; and it 'disappears' from the list after BUZZOFF() (as per your screen shot).

However, as soon as I run BUZZON(39), I get a reset and the 'CPU exception 10' error message

[quote]You do have the later version 5.2? Geoff did a very minor update after a couple of weeks.[/quote] I am running the version on his website. This could be the issue. Can you link me to the Firmware version you are running there please!


[quote]
UPDATE

Change the subroutine definition to

CSUB BUZZON(INTEGER)

I bet you haven't set the default data type to be integer and it is passing the number as a float


Made no difference I'm afraid - still getting the issue!

So looks like it maybe the Firmware version

WW
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 09:10am 30 Aug 2016
Copy link to clipboard 
Print this post

PRINT mm.ver


returns 5.02
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 09:48am 30 Aug 2016
Copy link to clipboard 
Print this post

  matherp said   All the CFunction does is change the value of the OPTION location for the buzzer so the difference can only be that the location is different somehow.


I am by no means a C Function/Sub creator; but does your statement above mean that every time there is a firmware update then any CSubs could 'fail' in the 'newer' firmware?
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:11am 30 Aug 2016
Copy link to clipboard 
Print this post

As an alternative to turning the option for the beep pin on & off.

Are you able to make the cFunction change the length of the click?

Page 18 indicates that around 3mS is used to produce a click.
If function could change this internally to zero, the click could be disabled, but the beeper would still be available for alarms etc without the need to change the options again.

Phil.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2948
Posted: 10:14am 30 Aug 2016
Copy link to clipboard 
Print this post

  Phil23 said   Are you able to make the cFunction change the length of the click?


I like your thinking - a better alternative IMHO
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 10:19am 30 Aug 2016
Copy link to clipboard 
Print this post

While still on the topic - I don't like that GUI BEEP requires a display being defined. It would have been much better if it was only BEEP and completely independent from any LCD. Then if necessary it could be linked to a touch even by some option command.

http://rittle.org

--------------
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:22am 30 Aug 2016
Copy link to clipboard 
Print this post

  matherp said  You do have the later version 5.2? Geoff did a very minor update after a couple of weeks.


Interesting, I would have downloaded my copy as soon as it went up.
Wonder if that has any bearings on some of my issues?

How are the versions distinguished?

Do they all report as MM.Ver 5.02?

Phil.


Edit; Just looked at what I have been using here,




And what's currently on Geoff's site,



Looks like only Plus had some changes.Edited by Phil23 2016-08-31
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 01:32am 31 Aug 2016
Copy link to clipboard 
Print this post

The change was made at the bottom of this thread.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025