Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:29 01 Aug 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 : PicoMite: suggestion regarding making named pins easier

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 10:06am 30 Oct 2021
Copy link to clipboard 
Print this post

Hi,

I would like to be able to do things like this:

Const BATTERY_PIN% = GP26
...
SetPin BATTERY_PIN%, AIN
...
battery! = Pin(BATTERY_PIN%)


And then if I want to change the pin connected to the battery voltage I just need to change the BATTERY_PIN% constant.

This doesn't work because in this context GP26 is interpreted as an undefined variable.

Assuming you agree this is desireable, perhaps (space permitting) something like this might suffice:

Const BATTERY_PIN% = Mm.Info(PIN GP26)

or

Const BATTERY_PIN% = Pin(Index GP26)


Or alternatively allow string variables to be used for specifying the pin in SETPIN and PIN.

YMMV,

Tom
Edited 2021-10-30 20:14 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 10:56am 30 Oct 2021
Copy link to clipboard 
Print this post

Doesn't sound unreasonable as
Const mypin = 1
Setpin mypin,din
a = Pin(mypin)
Print a

works fine but
Const mypin = GP0
Setpin mypin,din
a = Pin(mypin)
Print a

doesn't.
Saved 53 bytes
[2] SetPin mypin,din
Error : Pin 0 is reserved on startup
>

Edited 2021-10-30 20:59 by Mixtel90
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 11:16am 30 Oct 2021
Copy link to clipboard 
Print this post

You are late to the game Mick, Peter implemented the MM.INFO based approach within 10 minutes of me suggesting it .

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 11:33am 30 Oct 2021
Copy link to clipboard 
Print this post

I saw that just after I'd posted. lol

I like my way better though. :)
Edited 2021-10-30 21:35 by Mixtel90
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 11:37am 30 Oct 2021
Copy link to clipboard 
Print this post

  Mixtel90 said  I like my way better though. :)


What's your way? If it was for this to work:
Const mypin = GP26

then that would require one function slot for each GP constant.

Best wishes,

Tom
Edited 2021-10-30 21:54 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 12:00pm 30 Oct 2021
Copy link to clipboard 
Print this post

I didn't say my way was better, just that I like it more. :) It's not practical, I don't think (but the conversion does take place elsewhere).
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
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