GetTris fails on PORTJ on 18F87J50

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
User avatar
RangerBob
Posts: 152
Joined: Thu May 31, 2007 8:52 am
Location: Beds, UK

GetTris fails on PORTJ on 18F87J50

Post by RangerBob » Fri Jul 01, 2011 1:59 pm

Hello All,

Not entirely sure whats going on here but I have a problem around the following code on a 18F87J50:

Code: Select all

// default module options - user options can override these values...
#option GLCD_DATA = PORTJ        // data port
...

// now create Data TRIS...
#option _GLCD_DATA_TRIS = GetTRIS(GLCD_DATA)

...

// port and pin settings, these are brought into
// the program by using the above options...
Public Dim        
   Data As GLCD_DATA,           // data in (PORT) 
   TRISData As _GLCD_DATA_TRIS, // data TRIS      <--- Compiler error lists here at _GLCD_DATA_TRIS
   RS As GLCD_RS.GLCD_RS@,      // RS pin (reset pin)
   DC As GLCD_DC.GLCD_DC@,      // DC pin (data or command)
   RW As GLCD_RW.GLCD_RW@,      // RW pin (read or write)
   CS As GLCD_CS.GLCD_CS@,      // chip select
   RD As GLCD_RD.GLCD_RD@,       // Read select
   POWER1 As GLCD_POWER1.GLCD_POWER1@,	// VDD power control
   POWER2 As GLCD_POWER2.GLCD_POWER2@   // VCC power control
The complier fails with the following error at the marked point with

Code: Select all

[Error]SSD0323.bas(119): Invalid variable type : TRISI
Note the error references TRISI, not TRISJ as should be. There is no reference to TRISI from me anywhere (plus it doesn't exist).

Compiling for any other lower port (A to H) works fine. Of course this doesn't help me as my boards are all set for port J.

Any help gratefully appreciated.

Best Regards,

Nathan[/code]

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 » Fri Jul 01, 2011 2:19 pm

Hi Nathan

Yes, it seems to be a problem caused by the lack of 'I' port. So as you point out, the ports on this device go

Code: Select all

...
TRISF
TRISG
TRISH
TRISJ
I'll look into it. However, as a workaround, you can 'fake' the existence of an 'I' port so the compiler doe not complain

Code: Select all

// default module options - user options can override these values...
Private Dim TRISI As Byte Absolute $0F9A // workaround - fake a port
#option GLCD_DATA = PORTJ        // data port

User avatar
RangerBob
Posts: 152
Joined: Thu May 31, 2007 8:52 am
Location: Beds, UK

Post by RangerBob » Fri Jul 01, 2011 3:03 pm

OK, thanks for the fast response David.

Nice to know its not just me doing something dumb on a Friday afternoon then!

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 » Wed Jul 06, 2011 10:48 am

There is an update available which should now fix this problem

http://www.sfcompiler.co.uk/forum/viewtopic.php?t=1510

Post Reply