Atmel AVR2070 Manual De Usuario

Descargar
Página de 93
 
AVR2070
 
 
57
8240B-AVR-06/09 
  #   define HAL_INIT_ADC() DIDR0 |= (1 << ADPIN), \ 
      ADMUX = 0xC0 | ADPIN, ADCSRA = 0x84 
  #   define HAL_STOP_ADC() ADCSRA &= ~0x80 
  #   define HAL_SAMPLE_ADC() ADCSRA |= (1 << ADSC) \ 
      | (1<< ADIF) 
  #   define HAL_WAIT_ADC() while (!(ADCSRA | (1<<ADIF))) {;} 
  #   define HAL_READ_ADC() ADC 
  #   define BAND BAND900    // RF212 
 
  // LED Macros 
  #define LED_INIT() (DDRE |= ((1<<2) | (1<<3) | (1<<4)),\ 
          PORTE |= ((1<<2) | (1<<3) | (1<<4))) 
  // LED_ON(led), where led = 1-3 
  #define LED_ON(led) (PORTE &= ~(1 << (led+1))) 
  #define LED_OFF(led) (PORTE |= 1 << (led+1)) 
 
  // Button macros 
  #define BUTTON_SETUP()    DDRE &= ~(1 << PE5), \ 
                            PORTE |= (1 << PE5) 
  #define BUTTON_PRESSED() (DDRE &= ~0x20, \ 
               PORTE |= 0x20, !(PINE & 0x20)) 
 
Note that some features may not be available on a new platform, like the ADC 
converter or the LED’s and button.  To leave a feature out of the platform definition, 
define it as nothing, so that the compiler will not complain about the missing symbol: 
        #   define HAL_INIT_ADC() 
        #   define HAL_STOP_ADC() 
        #   define HAL_SAMPLE_ADC() 
        #   define HAL_WAIT_ADC() 
        #   define HAL_READ_ADC() 0 
        #   define BUTTON_SETUP() 
        #   define BUTTON_PRESSED()  0 
        #   define LED_ON() 
        #   define LED_OFF() 
 
After checking these definitions against the schematic, compile the RUM code.  Be 
sure to specify the correct microcontroller definition in the project options, or Makefile 
on Linux, so that it matches the definition in the platform block as shown above.  Fix 
any compilation errors. 
B.4.3 Step 3: Verify that the transceiver is communicating with the microcontroller 
To verify that the definitions in hal_avr.h or hal_arm.h are working, the firmware must 
be run to see if the microcontroller is able to read and write to the radio via the SPI 
port.  There are two ways to do this.  Try one of the following. 
1.  If a serial port is available on the new platform, compile RUM with the 
DEBUG flag set to one, and connect a serial port to the target.  Using a 
terminal program, open the target's serial port (38.4Kbps, n, 8, 1, no flow