Detecting 28X port state

nbw

Senior Member
Hi all, I did a bit of a search of how to detect the state of various 28X port pins. Hippy posted some info on safe reading from $30 onwards. I only want to PEEK the high/low status of one particular portc pin that is initialised as an output and stays that way.

Does anyone have a list of how the hex address corresponds to the particular pin? e.g. $30 = portc1, etc?

kind regards
 

hippy

Ex-Staff (retired)
You can use "PEEK $30,variable" to get the current state of the output pins, and then by bit masking ( or using the bit0-bit7 variables if loaded into b0 )you can determine the state of an output pin ...

- PEEK $30,b0
- IF bit3=0 THEN Pin3IsLow

or

- PEEK $30,b7
- b7 = b7 & %00001000 ' Mask off bit 3
- IF b7 = 0 THEN Pin3IsLow
 

craigcurtin

Senior Member
Hippy,

That code works for me and returns the state of the standard Output pins - how do i get at the "extended" pins i.e. PortC1 etc ??

regards

Craig
 

hippy

Ex-Staff (retired)
Sorry, I mis-read my datasheet as PORTC being the standard output pins.

I believe that "PEEK $07" then masking will do what you need.
 

craigcurtin

Senior Member
thanks Hippy - when you refer to datasheets for this information (i am a newbie) where are these found and are they human readable or just for the gurus ??

Craig
 

hippy

Ex-Staff (retired)
The datasheets aren't simple and do require an understanding of the PICmicro which is the heart of the PICAXE.

The first thing to do is determine which PICmicro each PIACXE is based upon. Not sure where that is documented, but I have my own list ...<code><pre><font size=2 face='Courier'>PICAXE-08 12F629
PICAXE-08M 12F683
PICAXE-18 16F627
PICAXE-18A 16F819
PICAXE-18X 16F88
PICAXE-28 16F872
PICAXE-28A 16F872
PICAXE-28X 16F873A
PICAXE-40X 16F874A </font></pre></code> Then it's off to www.microchip.com where they can be downloaded from.
 
Top