Shop OBEX P1 Docs P2 Docs Learn Events
A couple of newbie questions — Parallax Forums

A couple of newbie questions

Andy_FAndy_F Posts: 5
edited 2009-03-14 16:20 in Propeller 1
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-14 01:27
    1) There are no weak pullups, so there's no way to enable them. You need external pullups when you require pullups

    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
  • Andy_FAndy_F Posts: 5
    edited 2009-03-14 16:20
    Mike Green said...
    1) There are no weak pullups, so there's no way to enable them. You need external pullups when you require pullups


    Hmm, that complicates things a little, but I can manage.


    Thanks for the information Mike!
Sign In or Register to comment.