A couple of newbie questions
Andy_F
Posts: 5
Sorry if these have been asked and answered before, but I couldn't find them.
I am not new to microcontrollers, but new to the propeller, so here goes:
1. On the MCU's I am familiar with, you have to set a register to enable weak pull-up resistors on inputs.
Am I right in assuming the Propeller does this automatically when you set a pin as an input? Or am
I missing something?
2. I know that I can check if an input is low by:
IF not INA[noparse][[/noparse]pin]
(do something)
But, how do you check if the pin is high? Is it:
IF INA[noparse][[/noparse]pin]
(do something)
or is it:
IF INA[noparse][[/noparse]pin] == 1
(do something)
Or am I completley out to lunch here?
Thanks for any assistance on this.
Andy
I am not new to microcontrollers, but new to the propeller, so here goes:
1. On the MCU's I am familiar with, you have to set a register to enable weak pull-up resistors on inputs.
Am I right in assuming the Propeller does this automatically when you set a pin as an input? Or am
I missing something?
2. I know that I can check if an input is low by:
IF not INA[noparse][[/noparse]pin]
(do something)
But, how do you check if the pin is high? Is it:
IF INA[noparse][[/noparse]pin]
(do something)
or is it:
IF INA[noparse][[/noparse]pin] == 1
(do something)
Or am I completley out to lunch here?
Thanks for any assistance on this.
Andy
Comments
2) The IF statement uses zero for false and non-zero for true, so either 'INA[noparse][[/noparse]pin]' or 'INA[noparse][[/noparse]pin] == 1' will work
Hmm, that complicates things a little, but I can manage.
Thanks for the information Mike!