Project

General

Profile

Revision 617

changed orbs to use binary constants to see if its fixed

View differences:

trunk/code/projects/autonomous_recharging/charging_station/new station driver code/orb.c
37 37

  
38 38

  
39 39
int main (void){
40

  
41
DDRB = _BV(DDB4);
42
DDRD = _BV(DDD4)|_BV(DDD6);
43

  
44
PORTB = 0b01010000;
45
PORTD = 0b00010000;
46

  
47
//orb_init();
48
//set_orb(100, 100, 100);
40
orb_init();
41
set_orb(0, 0, 200);
49 42
while(1);
50 43
return 0;
51 44
}
......
66 59
int orb_init (void)
67 60
{
68 61
	/*data direction registers, blue, green (bit 7) and red (bit 5)*/
69
	DDRB = _BV(DDB4);
70
	DDRD = _BV(DDD4)|_BV(DDD6);
62
	//DDRB = _BV(DDB4);
63
	DDRB = 0b00010000;
64
	
65
	//DDRD = _BV(DDD4)|_BV(DDD6);
66
	DDRD = 0b01010000;
71 67

  
72 68
	
73 69
	/*blue is here. it goes on timer 0*/
74 70
	/*timer counter control registers for timer 0*/
75
	TCCR0A = _BV(COM0B1)|_BV(COM0B0)|_BV(WGM01)|_BV(WGM00);
76
	TCCR0B = _BV(CS00);
71
	//TCCR0A = _BV(COM0B1)|_BV(COM0B0)|_BV(WGM01)|_BV(WGM00);
72
	TCCR0A = 0b00110011;
73
	
74
	//TCCR0B = _BV(CS00);
75
	TCCR0B = 0b00000001;
77 76
	OCR0B = 0;
78 77
   
79 78
	/*green is here. it goes on timer 2*/
80
	TCCR2A = _BV(COM2B1)|_BV(COM2B0)|_BV(WGM21)|_BV(WGM20);
81
	TCCR2B = _BV(CS20);
79
	//TCCR2A = _BV(COM2B1)|_BV(COM2B0)|_BV(WGM21)|_BV(WGM20);
80
	TCCR2A = 0b00110011;
81
	
82
	//TCCR2B = _BV(CS20);
83
	TCCR2B = 0b00000001;
82 84
	OCR2B = 0;
83 85
	
84 86
	
85 87
	/*red is here. it goes on timer 1 which counts to the value in ICR1 instead of 8 bits*/
86
	TCCR1A = _BV(COM1B1)|_BV(COM1B0)|_BV(WGM11);
87
	TCCR1B = _BV(WGM13)|_BV(WGM12)|_BV(CS10);
88
	//TCCR1A = _BV(COM1B1)|_BV(COM1B0)|_BV(WGM11);
89
	TCCR1A = 0b00110001;
90
	
91
	//TCCR1B = _BV(WGM13)|_BV(WGM12)|_BV(CS10);
92
	TCCR1B = 0b00011001;
88 93
	ICR1 = 0x9C40;
89 94
	OCR1B = 0;
90 95
   

Also available in: Unified diff