|
Forum Index : Microcontroller and PC projects : Quick PORT question....
| Author | Message | ||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9750 |
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: AustraliaPosts: 3308 |
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 ZealandPosts: 9750 |
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: AustraliaPosts: 3308 |
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 ZealandPosts: 9750 |
I stand corrected. ![]() Thanks. Smoke makes things work. When the smoke gets out, it stops! |
||||
redrok![]() Senior Member Joined: 15/09/2014 Location: United StatesPosts: 209 |
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 StatesPosts: 209 |
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: AustraliaPosts: 3308 |
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 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |