Error In pull-up mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

hi friends, i was making a simple keycheck program, i selected the pins(p1.0, p1.2, p1.4, p1.6), where i connect push-buttonsand made them in pull-up mode so that on pressing the key, ground makes the pins active.

   

But on selecting all these 4 pins to pull-up mode, i realised that only p1.0 was initally pulled up but no other pin was pulled up , though i selected all the 4 pins to be in  pull-up mode.

   

I need help, as i need 4  buttons to run my project, so whats the probllem with this, or is there any other solution to it.

   

 

   

my program:

   

 

   

_main:

   

mov REG[PRT1DR], 255

   

keypad:

   

TST REG[PRT1DR], %00000001

   

jnz nextkey

   

call tx_front

   

 

   

nextkey:

   

TST REG[PRT1DR], %00000100

   

jnz nextkey1

   

call tx_back

   

 

   

nextkey1:

   

TST REG[PRT1DR], %00010000

   

jnz nextkey2

   

call tx_left

   

 

   

nextkey2:

   

TST REG[PRT1DR], %01000000

   

jnz keypad

   

call tx_right

   

 

   

jmp keypad

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

I don't see anything that immediately looks wrong with this code.

   

What does the code in your "tx" functions look like?

   

Are you doing any ANDs or ORs with the PRT1DR register anywhere else. If you are, this can cause the pull up drive mode to get disabled on other PRT1DR bits.

0 Likes