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

setup_ccp2() & Set_uart_speed() Function Errors

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








setup_ccp2() & Set_uart_speed() Function Errors
PostPosted: Thu Mar 25, 2004 11:49 am     Reply with quote

Hi am recompiling some old code which compiled fine with PCH 3.158

Now if I recompile the same code with PCH 3.187 Latest release I get the error Undefined Identifier for setup_ccp2(PWM), set_pwm1_duty(0xc0)set_uart_speed(19200).

eg. below which will cause errors

It should compile fine as is. It you remove comments the errors will occur.


#include <18F252.h>
#fuses hs, nowdt, noprotect, nolvp, put, NOOSCSEN
#device *=16 icd=TRUE
#device adc=8

#define BAUD1_SPEED 9600
#define BAUD2_SPEED 19200

#use delay(clock=9830400) /////////// Check Crystal Value ////////////

#use rs232(baud=BAUD1_SPEED, xmit=PIN_C6, rcv=PIN_C7)


main()
{
setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM
// setup_ccp2(CCP_PWM); // Configure CCP2 as a PWM
set_pwm1_duty(0xc0);
// set_pwm2_duty(0xc0);

// set_uart_speed(BAUD2_SPEED);

}


Thanks in advance for any help on this.

Jerry Smile
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

CCP2
PostPosted: Thu Mar 25, 2004 12:41 pm     Reply with quote

I have never tried to use the second CCP on this chip but offhand for the CCP2 to work it looks like you have to tell the compiler which pin to activate it for by using the CCP2B3 or CCP2C1 fuses. You can find these defined in the 18F252.h file.

Not sure right off what your problem with the Baud set problem is caused by... Maybe someone else here can spot that.

Regards,
Dave
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

Re: CCP2
PostPosted: Thu Mar 25, 2004 12:51 pm     Reply with quote

dyeatman wrote:
I have never tried to use the second CCP on this chip but offhand for the CCP2 to work it looks like you have to tell the compiler which pin to activate it for by using the CCP2B3 or CCP2C1 fuses. You can find these defined in the 18F252.h file.

Not sure right off what your problem with the Baud set problem is caused by... Maybe someone else here can spot that.

Regards,
Dave


Thanks Dave for quick reply.

I tryed your suggestion to add the fuse CCP2C1, but I still get the same error.

Did you try to compile the posted code.?

Thanks again;

Jerry Smile , I do not know why it logged me in as guest the first time.
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

CCP2
PostPosted: Thu Mar 25, 2004 1:11 pm     Reply with quote

No, I am not at a point where I can do that right now. I just saw the fuse and thought you might try it for a quick fix. It will be later this afternoon before I can get to the development bench to compile the code and really see what is going on.... I hope someone is able to catch this quickly , if not I will later.

Regards,
dave
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

CCP2
PostPosted: Thu Mar 25, 2004 1:26 pm     Reply with quote

I just got a chance to test it with 3.187 and 3.158 and it compiles just fine with both versions.

CCS PCH C Compiler, Version 3.158

Filename: c:\ccs_c\projects\test18f252.LST

ROM used: 72 (0%)
Largest free fragment is 31864
RAM used: 5 (0%) at main() level
5 (0%) worst case
Stack: 0 locations

CCS PCH C Compiler, Version 3.187

Filename: c:\ccs_c\projects\test18f252.LST

ROM used: 72 (0%)
Largest free fragment is 31864
RAM used: 5 (0%) at main() level
5 (0%) worst case
Stack: 0 locations
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Thu Mar 25, 2004 4:39 pm     Reply with quote

Believe it or not, I had the exact same problem once, although with setup_ccp1(). If I remember correctly, it was after installing the latest version of the compiler (can't remember what version). I got the "Undefined Identifier for setup_ccp1()" error. I re-installed PCM3.169 and the code compiled fine, but when I installed the new version again I got the same error. I thought CCS guys had introduced a new bug in the latest version (which happens often), so I created a small project showing the error and sent it to them. The next day I got a reply saying my code compiles fine on their side (same thing that happened between you and dyeatman)...To make the long story short, the error went away after I restarted my machine. I never found out what caused it or what solved it, maybe rebooting got rid of some old DLL sitting in the memory. So I recommend you to do so too.

Last edited by Haplo on Thu Mar 25, 2004 6:44 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 25, 2004 5:17 pm     Reply with quote

Also, be aware that from time to time, CCS will change how the
functions use the constants in the .h files.

For example, in the current 16F628.H file, it uses 24-bit constants
for the setup_comparator() function. Example:

#define NC_NC_A1_A2 0x6ff05

In older versions of the compiler, it used different values and
they were not 24-bits.

So if you keep a local copy of the .h file in your project directory,
and then you upgrade the compiler without also updating that
local .h file, you may find that some functions no longer work.
They compile OK -- they just won't work.
Jerry I



Joined: 14 Sep 2003
Posts: 96
Location: Toronto, Ontario, Canada

View user's profile Send private message

setup_ccp2() & Set_uart_speed() Function Errors
PostPosted: Fri Mar 26, 2004 6:32 pm     Reply with quote

Sad Thanks for all the answers.

I think it is a matter that I have to update my registration files.

I get an intial error that reg files are to old. Then when installation is complete it says the reg files are ok.

Thanks all;

Jerry
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