View previous topic :: View next topic |
Author |
Message |
Guest
|
Undefined Identifier - setup_spi(SPI_SS_DISABLED) --Problem |
Posted: Mon Dec 22, 2008 7:00 am |
|
|
Hi,
I programmed a 18F4550 PIC and I successfully ran some tests. But now when I am compiling, the compiler gives the following error,
Undefined Identifier - setup_spi
Undefined Identifier - setup_vref
I am not using any SPI communications in my code. Following is the place where the error occurs,
Code: |
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
//setup_timer_2(T2_DISABLED);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
setup_vref(FALSE);
|
What could be the error?
Thanks a lot. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Dec 22, 2008 7:41 am |
|
|
Always post your compiler version number!
Code: | setup_spi(SPI_SS_DISABLED); | SPI_SS_DISABLED is used to disable the Slave Select (SS) pin at a SPI slave device. Here your setup is incomplete as the parameters for master or slave operation are missing.
If you just want to disable SPI , then use: |
|
|
Guest
|
|
Posted: Mon Dec 22, 2008 8:30 am |
|
|
Compiler version is 4.057
I changed the following,
Code: |
setup_spi(SPI_SS_DISABLED);
|
into
But the problem is still there. And that code I posted earlier is a code that is auto generated from the PIC Wizard. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Dec 22, 2008 9:51 am |
|
|
Strange, both the original code and my suggested change compile in v4.057 without problems.
You didn't post a complete program, so my guess is you made an error at an earlier point in the code. Make sure your program starts with the line: Code: | #include <18F4550.H> |
|
|
|
Guest
|
|
Posted: Mon Dec 29, 2008 8:33 am |
|
|
Hi,
What if I completely comment out the two lines? It compiles when I did so. I do not want to use SPI in my program.
Thanks... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Dec 29, 2008 9:44 am |
|
|
Who told you to use a SPI built-in function in your code? SPI is disabled by default. |
|
|
|