CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Compiler Update

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

Compiler Update
PostPosted: Tue Jul 16, 2013 2:49 pm     Reply with quote

The code I have been using for several years worked fine until I recently updated. I'm using the CCS Modbus library but it has been modified to suit me needs (Choice of ASCII or RTU during runtime).

Anyways, there is a line there that nows fails to compile and I have no idea what its talking about.

Code:

     #if (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA)
         #if getenv("sfr:TXSTA")
            #byte TXSTA=getenv("sfr:TXSTA")
         #else
            #byte TXSTA=getenv("sfr:TXSTA1")
         #endif
   


BAD SFR Name TXSTA

When did it become Bad and what is it suppose to be now?

Richard
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 16, 2013 3:04 pm     Reply with quote

Tell us your PIC, and your old and new compiler versions.
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Tue Jul 16, 2013 3:08 pm     Reply with quote

The pic I'm using is a 18F26J50 and I upgraded from version 4 something to 5.009. I do not remember the last version 4xx I had installed because even though I told version 5 to keep it, it did not.

Richard
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Tue Jul 16, 2013 5:30 pm     Reply with quote

In the install directory for the compiler, there is a file called sfr.txt - snoop through that and see if you see the register you are looking for. I seem to remember names changing in the past.

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 8:28 am     Reply with quote

Worth saying that 4.141, is available from the download link. When you select to download 5.00x, there is a little button to download the last V4 compiler.
You have to install the compilers into a different directory to get the old version 'retained'.

The reason for your problem though is that the 26J50, has two hardware UART's, so TXSTA1, and TXSTA2, not just TXSTA.....

Best Wishes
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 8:50 am     Reply with quote

Thanks,
But the generic library had defines for different mcu's and even though we are not using that mcu and that define should be jumped over, it shouldn't be a syntax error should it?

I also have Invalid ORG Range on the same statement I used for my bootloader for sometime now.

Code:

#import(FILE=my_GPS_bootloader.hex,HEX,RANGE=0:0x1FFF)


That range use to compile and now it doesn't.

Richard
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 9:30 am     Reply with quote

Perhaps 90% of PIC's only have one UART. So the code was written to just handle this.
Remember the CCS 'libraries' are not designed to be complete solutions to anything, but give you 90% of the work done.
They assume that on a chip with dual UART's, you will have to make the decision yourself, which one you want to use....

You need to recompile the my_GPS_bootloader file with the new compiler before it can be imported. The 'range error', is because the old file can't be understood.

Best Wishes
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 9:47 am     Reply with quote

I'm having no luck. Thanks for the help however their newest lib has the same issue. I define that I'm using the USART 1 by doing this:

Code:

#define MODBUS_TYPE MODBUS_TYPE_SLAVE
#define MODBUS_SERIAL_TYPE MODBUS_RTU   
#define MODBUS_SERIAL_RX_BUFFER_SIZE 64
#define MODBUS_SERIAL_BAUD 9600
#define MODBUS_PARITY "NONE"
 
#define MODBUS_SERIAL_INT_SOURCE MODBUS_INT_RDA


Here in their code, it fails, invalid FSR Name:
Code:

#if (MODBUS_SERIAL_INT_SOURCE != MODBUS_INT_EXT)
   #if defined(__PCD__)
      #if (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA)
         #word TXSTA=getenv("SFR:U1STA")
         #bit TRMT=TXSTA.8
      #elif (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA2)
         #word TXSTA=getenv("SFR:U2STA")
         #bit TRMT=TXSTA.8
      #elif (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA3)
         #word TXSTA=getenv("SFR:U3STA")
         #bit TRMT=TXSTA.8
      #elif (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA4)
         #word TXSTA=getenv("SFR:U4STA")
         #bit TRMT=TXSTA.8
      #endif
   #else
      #if (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA)
     [size=18][color=red]    #if getenv("sfr_valid:TXSTA")[/color][/size]            #byte TXSTA=getenv("sfr:TXSTA")
         #elif getenv("sf_valid:TXSTA1")
            #byte TXSTA=getenv("sfr:TXSTA1")
         #else
            #byte TXSTA=getenv("sfr:TX1STA")
         #endif
      #elif (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA2)
         #if getenv("sfr_valid:TXSTA2")
            #byte TXSTA=getenv("sfr:TXSTA2")
         #else
            #byte TXSTA=getenv("sfr:TX2STA")
         #endif
     #elif (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA3)
         #if getenv("sfr_valid:TXSTA3")
            #byte TXSTA=getenv("sfr:TXSTA3")
         #else
            #byte TXSTA=getenv("sfr:TX3STA")
         #endif
     #elif (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA4)
         #if getenv("sfr_valid:TXSTA4")
            #byte TXSTA=getenv("sfr:TXSTA4")
         #else
            #byte TXSTA=getenv("sfr:TX4STA")
         #endif
      #endif
      #bit TRMT=TXSTA.1
   #endif
#endif



So, you can see they have the logic in there for different usarts. My pic has 2 uarts and I am using 1 for 485 modbus RTU and the 2nd for something else.

Problem is, this is a production board and I have to make a minor tweak and I'm stuck.
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 11:12 am     Reply with quote

As I said, 4.141 is available to download. Go to the page where you downloaded 5.009, and there is a button for the last V4 compiler.

Seriously, like most of the 'old hands' here, I always consider new releases 'beta at best'. The first couple of V5 compilers were 'alpha', and it is now 90%+ working, so might be considered 'beta'. However much simpler for an existing V4 project, to stick with V4.

I'd go back to the old driver sources, and just manually change TXSTA to TXSTA1.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 11:49 am     Reply with quote

It doesn't work in vs. 4.141. I tested it just now. But the PIC has two
UARTS so it will fail with just TXSTA. Change it to TXSTA1 and it works fine.
Quote:

Error 28 "PCH_Test.c" Line 5(23,24): Expecting an identifier Bad SFR name

Code:
#include <18F26J50.h>
#fuses HS,NOWDT
#use delay(clock=20M)

#if getenv("SFR:TXSTA")
 #warning got txsta
#endif

//======================================
void main(void)
{


while(1);
}
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 12:12 pm     Reply with quote

Thanks. I swore I tried TXSTA1. You're right. 4.141 did the same thing.
Last CD I had was 4.108 so I will uninstall everything and try that.

Man, it would be nice if this large stack of CD's had a sticker with version number and license code. Arghhhh.

I can't use V5. Way too many bugs on my end. Everytime I close a project I get List out of bounds errors and windows off the screen and real weird stuff. Going back and staying at 4.108 for awhile.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 12:53 pm     Reply with quote

Anything works with vs. 4.108. You can put in bogus SFR and it doesn't
give any error. Example (for the 18F26J50):
Quote:
#if getenv("SFR:TXSTA4")
#warning got txsta
#endif

This doesn't give any "invalid SFR" error:
Code:

#if getenv("SFR:XYZ123")
 #warning got txsta
#endif

It's clear that vs. 4.108 doesn't check the SFR name against its database.
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 3:19 pm     Reply with quote

I went back to Version 4.108 and it is working again and also my bootloader now compiles.

So, if I want to transition to v5.xxx can I just install everything in the PICC5 folder and use it to slowly get my stuff going?

Richard


PCM programmer wrote:
Anything works with vs. 4.108. You can put in bogus SFR and it doesn't
give any error. Example (for the 18F26J50):
Quote:
#if getenv("SFR:TXSTA4")
#warning got txsta
#endif

This doesn't give any "invalid SFR" error:
Code:

#if getenv("SFR:XYZ123")
 #warning got txsta
#endif

It's clear that vs. 4.108 doesn't check the SFR name against its database.
Jerson



Joined: 31 Jul 2009
Posts: 125
Location: Bombay, India

View user's profile Send private message Visit poster's website

PostPosted: Tue Jul 23, 2013 8:45 am     Reply with quote

Ttelmah wrote:


I'd go back to the old driver sources, and just manually change TXSTA to TXSTA1.


Not really needed. You just need to make this change and it should work Smile
Code:

     #if (MODBUS_SERIAL_INT_SOURCE == MODBUS_INT_RDA)
         #if getenv("sfr_valid:TXSTA")
            #byte TXSTA=getenv("sfr:TXSTA")
         #else
            #byte TXSTA=getenv("sfr:TXSTA1")
         #endif
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group