Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:37 01 Jul 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 : Using SETPIN with multiple pins

Author Message
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 07:49pm 24 Mar 2016
Copy link to clipboard 
Print this post

I'm sure there must be a reference that answers this question, but I'm blowed if I can find it. I want to program

SETPIN 2, DIN, PULLUP
SETPIN 5, DIN, PULLUP
SETPIN 16, DIN, PULLUP
...ETC.

I then signal branches of my program according to which pin is linked to earth, thus: IF PIN(2) = LOW THEN... (do something
ELSE... (or use CASE).

In my program I actually have several choices (a multiway switch). I am wondering if I can say something like

SETPIN 2,5,16... DIN, PULLUP

Senior?!  Whatever it says, I'm a complete and utter beginner...
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 10:15pm 24 Mar 2016
Copy link to clipboard 
Print this post

Hi
No you cannot set more than pin at a time.

You can read more than one pin at time with
PORT(start, nbr [,start, nbr]…)
(Manual page 76)

You can write to more than one pin at a time with
PORT(start, nbr [,start, nbr]…) = value
(Manual page 65)


Regards
Jman
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 10:22pm 24 Mar 2016
Copy link to clipboard 
Print this post

Thanks. And I remember the TRS80 so well, and David Lien's book too!
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 01:20am 25 Mar 2016
Copy link to clipboard 
Print this post

Which mite are you using?

I would use interrupts assuming there are enough available, no problem if using a plus as all I/O lines can be setup with interrupts.

See SETPIN pin, cfg, target [,option]

Then you only need a sub(Target) for each pin.
Rob White
 
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