Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 10:24 20 Apr 2024 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 : PicoMite OPTION AUDIO

     Page 1 of 2    
Author Message
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 07:28am 23 Jan 2022
Copy link to clipboard 
Print this post

I am using the OPTION as per the manual...OPTION AUDIO PWM GP18,GP19
but get and error 'Expression Syntax'
What am Idoing wrong.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5705
Posted: 07:38am 23 Jan 2022
Copy link to clipboard 
Print this post

Which version of the PicoMite firmware are you running? You can't use those pins with the VGA version. Use PRINT MM.VER to find out if you aren't sure. Otherwise your command looks OK to me.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 07:50am 23 Jan 2022
Copy link to clipboard 
Print this post

V 5.07.03 the latest version NOT VGA version.

Edit...Just checked MM.VER gives 5.0703
Edited 2022-01-23 17:52 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5705
Posted: 07:54am 23 Jan 2022
Copy link to clipboard 
Print this post

Seems strange then. I've not got a non-VGA version set up at the moment. I'll do one and see what happens. I assume you've not allocated tose pins to anything else. Have you tried different pins, such as GP16 / GP17 to get PWM0?
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 07:57am 23 Jan 2022
Copy link to clipboard 
Print this post

No havn't tried other pins, checked that these were not in use so tried to use them.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 08:02am 23 Jan 2022
Copy link to clipboard 
Print this post

Just tried GP0 and GP1,  same error
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5705
Posted: 08:11am 23 Jan 2022
Copy link to clipboard 
Print this post

Found it, I think. The command is
OPTION AUDIO GP18,GP19
I found the bit about PWMn a little confusing, never having used the audio out.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 08:21am 23 Jan 2022
Copy link to clipboard 
Print this post

That works, Thanks Mick
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8567
Posted: 08:21am 23 Jan 2022
Copy link to clipboard 
Print this post

Manual is misleading I've let Geoff know

  Quote  Example, OPTION AUDIO PWM GP18,GP19 would use PWM1A
and PWM1B on pins 24 and 25 respectively.


Should be

  Quote  Example, OPTION AUDIO GP18,GP19 would use PWM1A
and PWM1B on pins 24 and 25 respectively.
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1985
Posted: 09:53am 23 Jan 2022
Copy link to clipboard 
Print this post

...

deleted, ignore
Edited 2022-01-23 19:54 by CaptainBoing
 
flasherror
Senior Member

Joined: 07/01/2019
Location: United States
Posts: 159
Posted: 12:01pm 23 Jan 2022
Copy link to clipboard 
Print this post

Peter/Geoff,

1. Also see https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=14485&LastEntry=Y#180920#180916 for OPTION AUDIO question regarding left/right audio channel, as manual may need updating.

2. Is it possible to use just one PWM as Picomite audio output channel, leaving the other one free for I/O use? Ran out of I/O but need audio for playing sounds and mono audio is acceptable. There doesn't seem to be a way to config as mono, only stereo.
Edited 2022-01-23 22:05 by flasherror
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 08:51pm 24 Jan 2022
Copy link to clipboard 
Print this post

Still playing around trying to get some audio for an alarm sound. Still waiting on a small amp. Meantime I tried to use PWM to create a tone.
Picomite V5.0703
I have used....SetPin GP18,PWM1a  and then...PWM 1,1000,50 to generate the tone but
I get an error...Pin not set for PWM.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5705
Posted: 09:20pm 24 Jan 2022
Copy link to clipboard 
Print this post

PicoMite 5.0703
This works for me:

SETPIN GP18, PWM1A
PWM 1, 1000, 50
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 11:08pm 24 Jan 2022
Copy link to clipboard 
Print this post

I had option audio set on that pin, I since deleted the option but wonder if that is the problem. I'll try another pin.

Edit.    I tried...SetPin GP4,PWM2a  and  PWM 2,1000,50
and get the same error Pin not set for PWM.
Might be time to reflash the Pico.
Edited 2022-01-25 09:22 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 11:38pm 24 Jan 2022
Copy link to clipboard 
Print this post

OK I reflashed the chip but same problem.
Peter's post said...
  Quote  The 5.07.03 firmware is now released and available on Geoff's site together with the updated manual covering both versions

Warning: Loading these binaries will automatically wipe all flash the first time loaded so back up anything important first (clear_flash not necessary). This takes a few seconds before you will get the USB connection.

...but when I reflashed, the old code was in memory and the flash slots were unaltered.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 11:38pm 24 Jan 2022
Copy link to clipboard 
Print this post

Time to try another Pi Pico.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 02:43am 25 Jan 2022
Copy link to clipboard 
Print this post

Well the new PiPico does the same thing, below I have listed my code.
A digital speedo for my car with overspeed alarm. When the speed limit is exceeded the display turns RED and an alarm sounds (I wish).
When in use touching the screen left top sets 60kph in the middle sets 80kph and bottom left corner sets 100kph.
I simulated it's use by adding x=55 and in the loop SPD=x and incrementin x by 1 each pass with a 1 sec. pause.
When first started you have to be quick to touch the screen to set the limit.
If no GPS connected just comment out the respective lines.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' GPS SPEEDOMETER (PICOMITE)
' Paul Cahill----Jan 2022
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'OPTION SDCARD GP22
'OPTION SYSTEM SPI GP10,GP11,GP12
'OPTION LCDPANEL ST7789_320, LANDSCAPE,GP8,GP15,GP9,GP13
'OPTION TOUCH GP16,GP17
'GUI CALIBRATE 0, 408, 3901, 900, -646

CLS RGB(175,255,240)
COL = RGB(Yellow)

SetPin 1,2, COM1
SETPIN 15, INTL, AlSet
SetPin GP18,PWM1a

Open "COM1:9600" As gps,10                     ' open the GPS serial interface

Do
 Text 155,100, "Searching For", CM, 1, 2, RGB(black)
 Text 160,130, "Satellites", CM, 1, 2, RGB(black))
 
Loop While GPS(Valid) = 0
CLS (Black)

Do
 PWM 1, OFF
 COL = RGB(Yellow)
 am$="am"
 Date$ = GPS(Date)
 SPD = Cint(GPS(Speed)*1.852)
 SPEED$ = Str$(SPD,4)
 
 IF SPD > (SpSet + 2) and SPD < (SpSet + 6) Then
 COL = RGB(Red)
 Alarm
 Endif
 Time$ = GPS(Time)
 Hour$ = Left$(Time$,2)
 
 Minute$ = Mid$(Time$,4,2)
 If Val(Hour$) >12 Then
   Hour$ = Str$(Val(Hour$) - 12)             '12 Hour Mode
   am$ = "pm"
   HR = Val(HOUR$)
     Hour$ = Str$(HR)                         'Remove the leading zero
   EndIf
   Ti_me$ = Hour$+":"+Minute$
 EndIf
 ALTITUDE$ = Str$(Cint(GPS(Altitude)))
 
 
 ' display the date and time for this second
 Text 50,12,"SET "+Sp_Set$,CM,1,2,RGB(Yellow),RGB(Black)
 Text 235,12,Ti_me$+" "+am$,CM,1,2,RGB(Yellow),RGB(Black)
 Text 90,120,SPEED$,CM,8,1,COL,RGB(Black)
 Text 260,160,"kph",CM,1,2,COL,RGB(Black)
 Text 70,220,"Alt "+Altitude$+"m.",CM,1,2,RGB(Yellow),RGB(Black)
Loop

sub AlSet
If Touch(Y) < 100 Then SpSet = 60
If Touch(Y) >100 and Touch(Y) < 200 Then SpSet = 80
If Touch(Y) > 200 Then SpSet = 100
Sp_Set$ = Str$(SpSet)
End Sub

SUB Alarm
PWM 1,1000,50
End sub

Edited 2022-01-25 12:45 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5883
Posted: 02:52am 25 Jan 2022
Copy link to clipboard 
Print this post

When you turn the PWM OFF, you free up the pin.

This gives the error when you try and create a tone.

rem out the PWM 1,off and try.

Jim
VK7JH
MMedit   MMBasic Help
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1796
Posted: 02:55am 25 Jan 2022
Copy link to clipboard 
Print this post

Thanks Jim, how do I stop the alarm sounding. In the Micromite there was the command PWM STOP maybe its the sane for the Pico but it's not in the manual.
Edit.  OK The PWM command now OK, PWM STOP didn't work. I'll just move the SetPin command to the beginning of the loop I Think that will do it, but have to wait till I get my amp. or a piezo so I can hear it.
Edited 2022-01-25 13:31 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5883
Posted: 07:14am 25 Jan 2022
Copy link to clipboard 
Print this post

ON the CMM2, STOP does the same as OFF on the Pico
  Quote  The PWM function will take control of any specified outputs and when
stopped the pins will be returned to a high impedance "not configured" state.


Jim
VK7JH
MMedit   MMBasic Help
 
     Page 1 of 2    
Print this page
© JAQ Software 2024