View previous topic :: View next topic |
Author |
Message |
Guest
|
setup_ccp2() & Set_uart_speed() Function Errors |
Posted: Thu Mar 25, 2004 11:49 am |
|
|
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 |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
CCP2 |
Posted: Thu Mar 25, 2004 12:41 pm |
|
|
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
|
Re: CCP2 |
Posted: Thu Mar 25, 2004 12:51 pm |
|
|
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 , I do not know why it logged me in as guest the first time. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
CCP2 |
Posted: Thu Mar 25, 2004 1:11 pm |
|
|
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: 1934 Location: Norman, OK
|
CCP2 |
Posted: Thu Mar 25, 2004 1:26 pm |
|
|
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
|
|
Posted: Thu Mar 25, 2004 4:39 pm |
|
|
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
|
|
Posted: Thu Mar 25, 2004 5:17 pm |
|
|
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
|
setup_ccp2() & Set_uart_speed() Function Errors |
Posted: Fri Mar 26, 2004 6:32 pm |
|
|
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 |
|
|
|