View previous topic :: View next topic |
Author |
Message |
Homie
Joined: 11 Aug 2006 Posts: 11
|
code from avr to pic |
Posted: Wed Dec 26, 2007 11:16 am |
|
|
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 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
|
|
Posted: Wed Dec 26, 2007 11:57 am |
|
|
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
|
|
Posted: Wed Dec 26, 2007 12:06 pm |
|
|
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
|
|
Posted: Wed Dec 26, 2007 2:04 pm |
|
|
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
|
|
|
Homie
Joined: 11 Aug 2006 Posts: 11
|
|
Posted: Wed Dec 26, 2007 2:29 pm |
|
|
Thanks mate. Now I got it to work compile without errors |
|
|
|