Cant get the B port output pins to work

Grant666

Member
Hi All

Im using a 18m2 to run some LEDS. Basically I will run 8 LEDS off the output, then set code to turn on which output i want ie %00110010

My problem is that I cant get the portB outputs to work . I have used command "let outpinsB = %00000000" , but no joy !

Im used to the old 18X.


So If anyone can suggest where I have gone wrong, please let me know.

Thanks
 

inglewoodpete

Senior Member
Im using a 18m2 to run some LEDS. Basically I will run 8 LEDS off the output, then set code to turn on which output i want ie %00110010

My problem is that I cant get the portB outputs to work . I have used command "let outpinsB = %00000000" , but no joy !
The best place to start is to look at the LET command description. If you want a both-way pin to be an output, you need to be sure that it is configured as an output. Bothway pins on the M2 chips default to inputs. Check the DirsB parameter.
 

Skiwi

New Member
Code:
"let outpinsB = %00000000"
You are turning all B pins to low state, not setting them as outputs. As Inglewoodpete says, check the use of Let in Manual2


Try let dirsB = %11111111
 
Last edited:

inglewoodpete

Senior Member
You are turning all B pins to off state, not setting them as outputs.
It depends on how the LEDs are wired - a zero on the PICAXE pin could turn the LED on if the LED+resistor is wired to the +5v rail. However, I suspect that the first problem is the pin direction.
 

Technical

Technical Support
Staff member
On the 18X portB are fixed outputs. On 18M2 they can be input or outputs, so require configuration

So before using 'let outpinsB =' you need to turn the pins into outputs using

let dirsB = %11111111
 
Top