readportc or readportd?

tarzan

Senior Member
Picaxe_manual2.pdf
Version 6.6 11/2008

readportc or readportd?

Considering that this only applies to the 40X1 then is this an error that should read as readportd and not readportc?
 

westaust55

Moderator
Same command existed in rev 6.5b.
At the left side of the page, diagrams indicate it covers the 28X1 and 40X1.

While on the 40X1, portC is the extra 8-bit port with limited functions, on the 28X1, portC is the "normal" input port.

28X1 does not have portD.

So does it in fact read the "normal" inputs = portD for the 40X1 or is it really port C which could be useful as well.

Untested by me and I am not home to try . . . .
 
Last edited:

tarzan

Senior Member
readportc

After running in the simulator and on an actual chip it functions on portc so this means that the error is not including the 28X1 part in the description of its action.

I think we could also have readportd for the 40X1 part.

And why not for all ports?
readportc
Syntax:
READPORTC variable
- variable is a byte variable to receive the portc values
Function:
Read the portc value into variable.
Information:
The current state of the portc pins on the 40X1 part can be read into a variable
using the readportc command.
 

Technical

Technical Support
Staff member
The same compiler is used for both the 28X1 and 40X1.

To read the 'normal' inputs as a whole byte, simple use

let variable = pins

This will automatically read portC on the 28X1 and portD on the 40X1.

However the 40X1 also gives you the option to make all portC as 'extra' inputs aswell. So to read this byte you use a readportc command (which is actually just a pseudo command for end user convenience - it compiles as a 'peek' of the portc register).

You don't need a 'readportc' for the 28X1, or a 'readportD' for the 40X1, as that read situation is already covered by the normal 'pins' variable. If you do happen to accidentally use 'readportc' on the shared compiler on a 28X1 it will be the same as using 'pins'.
 
Top