Jump to content
Sign in to follow this  
Guest Joe

12C5xx auto-code generation

Recommended Posts

Guest Joe

It would be nice if we could program the TRIS for the 12C5xx devices:

 

gpio	= 00000000b;
tris	= 253;

 

As the tris register is not defined for this device, your compiler cannot generate the code and complains.

 

The Microchip datasheet states that in order to set the tris io pin direction register, you must execute a TRIS f

command (f=6 for 12c5xx), whereby the contents of the W register will be placed into tris:

 

So, when the compiler sees  tris = 253; I personally think it should generate:

 

; set    tris = 253
MOVLW .253     ; move data into W register
TRIS  .6       ; move W register to TRIS

 

Which is the correct ASM for setting the tris register.

 

So for all that are getting stuck on this, simply put this in your source code where you would like to change the tris values:

 

asm

{

   MOVLW 0x??   ; replace ?? with your hex value

   TRIS  0x06

}

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...