read all input pins C0-C7 on a 20M in one shot

albatros

New Member
Hi,

I need to read all input pins form the C.x pins with one command using a 20M2.

I found in the manual, that there is a command like:
Let b1 = pins & %110000000 (found on page 113 of the manual basic commands)

I also found on page 18 of the manual basic commands
Let b1 = pinsB
Is it possible to use also this for pinsC?
Let b1 = pinsC ?


Furthermore I found in the forum post: Accessing portC on 14M?? an discussion,
which ended up with using
Peek 07, b1, ; read the PortC register into byte variable b1. ....

I assume that 07 is the address of pportC0..7?

Which one is now the correct one / can be used ?

Thanks in advance

kind regards
alabatros

P.S: I searched the forum, but wasn't able to find a related questions / answe
 
Last edited:

albatros

New Member
Hi cachomachine,

thanks for the hint.
I test it on my breadboard and i identified - it must be
LET b0 = pinsC

I also worked out:
poke 80, pinsC
is also working - BUT the value is not shown on the PicAxe-Editore / Debug-Window.

I verfied it with the following lines of code

Let b0 = pinsC ;check in the DEBUG-Window: ok
poke 80, pinsC
peek 80, b2 ;check in the DEBUG-window: ok

kr
Albatros

P.S: Although the hint was not absolurely correct - it showed me the way forward - Thanks :D
 
Last edited:

hippy

Technical Support
Staff member
For M2 devices use b0=pinsC to read the port C pins.

PEEK and POKE will access variable space / RAM on the M2 devices. The PEEK and POKE commands behave differently on the earlier M devices.
 
Top