getting a tris definition for a pin?

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Jerry Messina
Swordfish Developer
Posts: 1473
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

getting a tris definition for a pin?

Post by Jerry Messina » Sun Mar 17, 2013 11:52 am

I have a #option that defines a pin...

Code: Select all

#option SCI_CK_PIN = PORTD.7
dim SCI_CK   as SCI_CK_PIN.SCI_CK_PIN@
From that, is there a way to get/create a way to access the TRIS.n for that pin?

dim SCI_CK_TRIS as ??????

If not, can some sort of macro work (ie SCI_CK_TRIS_HIGH()/SCI_CK_TRIS_LOW())?

I don't want to compute it at runtime. I'm looking for a method that lets me control the tris for the pin in a single instruction, and that will change if I change the #option for the pin definition.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Sun Mar 17, 2013 4:21 pm

This will work:

Code: Select all

#option SCI_CK_PIN = PORTD.7
#option SCI_CK_PIN_TRIS = GetTRIS(SCI_CK_PIN)
Dim SCI_CK As SCI_CK_PIN_TRIS.SCI_CK_PIN@ 

' set tris...
SCI_CK = 0

Post Reply