Re: [AVR-Chat] C programming Q
2004-06-10 by Valerij Avrealij
Çäðàâñòâóéòå, Javier.
Âû ïèñàëè 10 ôåâðàëÿ 2005 ã., 14:31:54:
> Hey all, i have a little C programming question....
> I am using a Atmel Dataflash Library which contais the next sentence
>
> DF_DD|=(1<<DF_MOSI)|(1<<DF_SCK)|(1<<DF_SS); // Set SCK, MOSI & SS as outputs
>
> i am defining:
> #define DF_DD DDRB // SPI Port Data Direction Register
> #define DF_PORT PORTB // SPI Port Register
> #define DF_SS PORTB.4 // Chip Select bit
> #define DF_SCK PORTB.7 // SPI Clock bit
> #define DF_MOSI PORTB.5 // SPI Master Out bit
> #define DF_MISO PINB.6 // SPI Master In bit
> #define DF_RDY PINC.5 // RDY/BSY Flag (Hardware)
Use such definitions
#define DF_SS 4 // Chip Select bit
#define DF_SCK 7 // SPI Clock bit
#define DF_MOSI 5 // SPI Master Out bit
#define DF_MISO 6 // SPI Master In bit
#define DF_RDY 5 // RDY/BSY Flag (Hardware)
You are using an bit shifting. You cann't shift an C extension
(POTRX.<digit>)
--
Valerij