examples/AVR/Slave/main.c
changeset 525 9b81decd4662
parent 413 57c7a451c671
child 675 e5c5101c4f0b
equal deleted inserted replaced
524:b94067330319 525:9b81decd4662
    24 Project description:
    24 Project description:
    25 Test projekt for a DS 401 slave, running on Atmel's STK500 with AT90CAN128
    25 Test projekt for a DS 401 slave, running on Atmel's STK500 with AT90CAN128
    26 Short description:
    26 Short description:
    27   PORTA:	Inputs (Keys, low active)
    27   PORTA:	Inputs (Keys, low active)
    28   PORTB:	Outputs (LEDs, low active)
    28   PORTB:	Outputs (LEDs, low active)
    29   PORTC:	Node ID (1 BCD switch)
    29   PORTC:	Node ID (1 BCD switch, low active)
    30 
    30 
    31 ******************************************************************************/
    31 ******************************************************************************/
    32 #include "hardware.h"
    32 #include "hardware.h"
    33 #include "canfestival.h"
    33 #include "canfestival.h"
    34 #include "can_AVR.h"
    34 #include "can_AVR.h"
   102 Initialize the relays, the main states and the modbus protocol stack.
   102 Initialize the relays, the main states and the modbus protocol stack.
   103 INPUT	LOCK_STATES *lock_states
   103 INPUT	LOCK_STATES *lock_states
   104 OUTPUT	void
   104 OUTPUT	void
   105 ******************************************************************************/
   105 ******************************************************************************/
   106 {
   106 {
   107   OSCCAL = 0x43;
   107   OSCCAL = 0x43;                        // adjust the RC oszillator
   108   
   108   
   109   PORTA = 0xFF;	                        // Inputs (Keys, low active) with pullup
   109   PORTA = 0xFF;	                        // Inputs (Keys, low active) with pullup
   110   DDRA  = 0x00;		                // 
   110   DDRA  = 0x00;		                // 
   111   PORTB = 0xFF;	                        // Outputs (LEDs, low active) all 1
   111   PORTB = 0xFF;	                        // Outputs (LEDs, low active) all 1
   112   DDRB  = 0xFF;		                // 
   112   DDRB  = 0xFF;		                //