Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:10 11 Nov 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 : Quick PORT question....

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9750
Posted: 03:11am 30 Mar 2018
Copy link to clipboard 
Print this post

With the PORT function, for reading several pins at once, the manual mentions you can repeat START/NBR can be repeated if another group of pins is needed.

How many times can you repeat that?
I have ten pins I want to read at the same time, but they are all over the place on the chip(44-pin).

Can I just use X=PORT(05,01,13,01,12,01,15,01,19,01,......)?

Is there a limit to the number of times you can repeat the groups(in my case, just specifying one bit rather then consecutive pins), or are you restricted to two groups as the manual suggests on page 78?
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 04:00am 30 Mar 2018
Copy link to clipboard 
Print this post

The maximum is 50 arguments or 25 start/nbr pairs. The function is reasonably efficient so you would not slow down your program if you used all 25 pairs.

Geoff
Geoff Graham - http://geoffg.net
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9750
Posted: 04:54am 30 Mar 2018
Copy link to clipboard 
Print this post

Awesome, thanks a bunch. I only need ten pairs for each of the ten bits.

Manual reads like you can only have two pairs. I seem to recall that might have been the case in an earlier version of MMBASIC - yes?
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 05:58am 30 Mar 2018
Copy link to clipboard 
Print this post

  Grogster said  Manual reads like you can only have two pairs. I seem to recall that might have been the case in an earlier version of MMBASIC - yes?

No, not ever.

I will update the manual to remove any confusion on this subject.
Geoff Graham - http://geoffg.net
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9750
Posted: 11:36pm 30 Mar 2018
Copy link to clipboard 
Print this post

I stand corrected.
Thanks.
Smoke makes things work. When the smoke gets out, it stops!
 
redrok

Senior Member

Joined: 15/09/2014
Location: United States
Posts: 209
Posted: 01:27am 31 Mar 2018
Copy link to clipboard 
Print this post

Hi Grogster;

Micromite User Manual MMBasic Ver 5.4

PORT(start, nbr [,start, nbr]…) = value
PORT(start, nbr [,start, nbr]…)

Both the command and function show the "..." before the ")"
This implies the preceding part can be repeated.

redrok
 
redrok

Senior Member

Joined: 15/09/2014
Location: United States
Posts: 209
Posted: 01:37am 31 Mar 2018
Copy link to clipboard 
Print this post

Hi Geoffg;

Would it be possible to have the port instruction switch the direction
of the pins such as:

PortDir(start, nbr [,start, nbr]…) = Value

Where the Value defines the pin direction, 1 = DIn, 0 = DOUT

This would be a very useful.

redrok
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 03:32am 31 Mar 2018
Copy link to clipboard 
Print this post

I was thinking of changing the SETPIN command so that it could set a number of pins simultaneously. I know that it is not the same but it is close.
Geoff Graham - http://geoffg.net
 
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