I have got confused with Ports and pins. Help Please.

HertzHog

Member
I have got in a muddle trying to move a program from one chip onto another.
I built a project on the AXE50 board using 18M2 and It seemed simple to control outputs

The 7 segment LED is labelled 0-7 and High 0 lights the Top segment labelled 0, High 1 lights segment labelled 1 etc. 7 lights the decimal point.
High 0,1 makes both 0 and 1 light.
I can have a base 10 numbered loop
Code:
Let x= 0 to 7 step 1
   high x ' That lights the segment x and it moves round the chip.
next
I am trying to extend to project using an 20M2 The LED is connected to the port C pins. I have found out C.6 is input only (I think I can get round that), but I can't see how to control the rest of the port C pins with a simple base 10 number loop? I am sure it is obvious. HertzHog
 

erco

Senior Member
See p. 71 of PicAxe manual 1, "Input/Output pin naming conventions". You can use outpinsC and dirsC to control your LEDs with byte commands, except for pin C.6 obviously.

Can't find it right now, but someone posted a clever workaround to the C.6 input only situation ~ 8-10 months ago. They triggered a FET using the pin's software-controlled pullup resistor. That may help you.
 

hippy

Ex-Staff (retired)
I can't see how to control the rest of the port C pins with a simple base 10 number loop? I am sure it is obvious.
Maybe not entirely obvious and the first step is to think in terms of pin identifiers, not pin numbers ...

For b0 = C.0 To C.7
High b0
Next

Or alternatively, if you do need to use numbers ...

For b0 = 0 To 7
b1 = C.0 + b0
High b1
Next
 
Top