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 support@ccsinfo.com

code from avr to pic

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



Joined: 11 Aug 2006
Posts: 11

View user's profile Send private message

code from avr to pic
PostPosted: Wed Dec 26, 2007 11:16 am     Reply with quote

Hi there im trying to change a driver for the Wiznet NM7010B+ netværks modul. its written for an avr chip, and im trying to get it to work on a pic. its hard because im not that good Smile now i got alot errors:

expecting an identifier

one of the errors is in this line:

Code:
void read_data(char s, volatile char * src, volatile char * dst, unsigned int len);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 26, 2007 11:57 am     Reply with quote

Quote:
void read_data(char s, volatile char * src, volatile char * dst, unsigned int len);

Delete the 'volatile' keyword in two places.

Also be aware that in CCS an 'int' is an unsigned 8-bit variable.
The other compiler may consider an 'int' to be a signed 16-bit variable.
If that is true, then in CCS you should change the declaration of
'unsigned int len' to 'int16' (or 'unsigned int16').
Homie



Joined: 11 Aug 2006
Posts: 11

View user's profile Send private message

PostPosted: Wed Dec 26, 2007 12:06 pm     Reply with quote

ok great i can just delete the volatile? i didnt knew that int is 8bit in CCS :P
thanks alot mate
Homie



Joined: 11 Aug 2006
Posts: 11

View user's profile Send private message

PostPosted: Wed Dec 26, 2007 2:04 pm     Reply with quote

is there anybode who can help me transform this code to pic??

Code:
/**
* __DEF_MCU_xxx__ : define option related to MCU
*/
#define __DEF_MCU_AVR__

#ifdef __DEF_MCU_AVR__
   #include <stdio.h>
   #include <string.h>
   #include <avr/interrupt.h>
   #include <avr/io.h>

   #ifdef __DEF_IINCHIP_INT__
      // iinchip use external interrupt 4
      #define IINCHIP_ISR_DISABLE()   (EIMSK &= ~(0x10))
      #define IINCHIP_ISR_ENABLE()   (EIMSK |= 0x10)
      #define IINCHIP_ISR_GET(X)      (X = EIMSK)
      #define IINCHIP_ISR_SET(X)      (EIMSK = X)
   #else
      #define IINCHIP_ISR_DISABLE()
      #define IINCHIP_ISR_ENABLE()   
      #define IINCHIP_ISR_GET(X)
      #define IINCHIP_ISR_SET(X)
   #endif
#endif
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 26, 2007 2:17 pm     Reply with quote

You don't need any of it in CCS. For example, see the small program
in this post, which shows how to do UART receiver interrupts with CCS:
http://www.ccsinfo.com/forum/viewtopic.php?t=30380&start=3
Homie



Joined: 11 Aug 2006
Posts: 11

View user's profile Send private message

PostPosted: Wed Dec 26, 2007 2:29 pm     Reply with quote

Thanks mate. Now I got it to work compile without errors Smile
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