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

Undefined identifier SPI_READ

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



Joined: 27 Mar 2005
Posts: 30

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

Undefined identifier SPI_READ
PostPosted: Sun Jun 17, 2007 12:28 pm     Reply with quote

I am trying to use a PIC18f67j60 to make a simple http server. I want to store the webpage on a MMC card and am having difficulty. The ethernet port tion of my board works and the MMC card works. But when I try to use them both I get this error

Undefined identifier SPI_READ

download the source here too many files to post
www.mattandbethrodney.com/tcpip.zip


It seems that the SPI is getting disabled in the source somewhere I just cannot find it. Any help would be appreciated

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 17, 2007 12:46 pm     Reply with quote

The following test program compiles OK with PCH vs. 4.041.
Code:
#include <18F67J60.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000) 

//===========================
void main()
{
int8 c;

c = spi_read(0);

while(1);
}


Also, your Zip file is reported as corrupt by Winzip. It's not usable.
Mattr0



Joined: 27 Mar 2005
Posts: 30

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

PostPosted: Sun Jun 17, 2007 1:02 pm     Reply with quote

Thank you I have fixed the file I posted.

I have also proven SPI to work in 4.042 but I cannot get it to work with the TCP module.

I figure that there is some thing left in there for the ENC28j60 that I cannot locate.

Matt
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 17, 2007 1:29 pm     Reply with quote

This sounds like a new problem. I am willing to help solve the very
narrow problem of "unidentified identifier". Is that problem now solved ?
I don't want to work on making TCPIP work. It's too large of a problem.
Mattr0



Joined: 27 Mar 2005
Posts: 30

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

PostPosted: Sun Jun 17, 2007 1:39 pm     Reply with quote

the problem is not with TCP. If I take out the MMC card driver it compiles OK and TCP works with out a problem. When I added the MMC driver I get

*** Error 12 "F:\MMC WEB SERVER\Example Code\TCP-IP\PIC Examples Source\MMC_FAT16.h" Line 161(23,31): Undefined identifier SPI_READ

and plenty more of them.

If I make a simple program to acsess the MMC card alone it works fine also.

I just can't figure this out
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Sun Jun 17, 2007 1:55 pm     Reply with quote

I have just try the code and found

Caps seem to be the problem

replace "SPI_READ" with "spi_read"

did this with the first error and compiled that error out

or could do a #DEFINE statement
#DEFINE SPI_READ spi_read

this then gets you to the next error
"undefind identifier MAKE8"
so I did #DEFINE MAKE8 make8

now the next error "undefind identifier false" "return(false);"

then added
#DEFINE false 0
#DEFINE true 1

and so on. have not completed however I did find in the past that reserved words are in lower case
_________________
What has been learnt if you make the same mistake? Wink
Mattr0



Joined: 27 Mar 2005
Posts: 30

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

PostPosted: Sun Jun 17, 2007 2:06 pm     Reply with quote

Thanks Let me try that.

I don't understand how the case sensitive is only on this project because this driver works as is for other projects.

Matt
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 17, 2007 2:09 pm     Reply with quote

That's what I found too. Darren has a #case statement in his driver file.
Then, someone (maybe you), has gone through other source files and
changed the case of the function name or various constants so they're
different from the standard CCS usage. That's the cause of the problem.
I would do a search and replace (case sensitive) on all these instances
and just fix them. Presumably Darren has got #case in there for some
reason, so it would be better to fix the case of the SPI_READ() names
and 'true' and 'false', than to remove #case statement.
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Sun Jun 17, 2007 2:25 pm     Reply with quote

I have removed the error
the whole thing felt like an exercise,
the errors appear to be deliberate, as the fix was to do minor typo's repairs even to add and "#include" lines.

Compiles with warnings not tested as there may be other errors

I found doing a search on the error I was able to find and replace with similar words.
ie "set_blocklen(512);" is to be "set_BLOCKLEN(512);"
_________________
What has been learnt if you make the same mistake? Wink
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 17, 2007 2:35 pm     Reply with quote

You're saying this was invented as an exercise for us ?
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Sun Jun 17, 2007 3:01 pm     Reply with quote

looks like it,
I enjoyed it!
The micro, code has similarities to a project I am planing to undertake at some time in the future, just need to add RS485, RS422 and RS232 RTC and a whole lot of code Confused Wink
_________________
What has been learnt if you make the same mistake? Wink
Mattr0



Joined: 27 Mar 2005
Posts: 30

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

PostPosted: Sun Jun 17, 2007 6:22 pm     Reply with quote

I found the #case statement I left it alone as who know why it is there in the first place.

I have fixed all of the errors and now it works fine thanks again

Matt
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