Jump to content
Sign in to follow this  
gviaud

SX target, Pullups and Direction

Recommended Posts

I am having trouble with an SX28 target trying to get the internal pullups to enable/disable in conjunction with code to set the port direction.  Can someone provide me with some sample code to do this for portA, portB and portC? I think this would be useful code for all (I know I will find it invaluable!)

 

Thanks.

 

George

Share this post


Link to post
Share on other sites

Hi there.

 

I don't have time for the long version right now, but I suspect

that your difficulty is caused by not using the Mode register

properly.

 

Here is how I set the tristate mode (direction) for port B

 

  asm mov m, 0xff

  asm mov !RB, _TrisImage

 

Moving the 0xff into "m", mode register, directs the mov !Rx

instruction to the tristate control register.

 

You set the mode register to different values depending upon

which control register you want the mov !Rx instruction to

modify.

 

Check the SX datasheet for details.  The default value of the

mode register is 0xff, which corresponds to the tristate control

register.  I think that 0xfe is the pull-up register, but I am not

sure.

 

I hope this helps a little...

 

Jim

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...