Revision 111

View differences:

branch/euphrasie_auguste/Emb_App/SessionM32C_E8a_system.ini
25 25
[Target]
26 26
M32C E8a SYSTEM=Renesas Communications
27 27
[USER_DATA]
28
RESET=ff001a
28
RESET=ff0020
branch/euphrasie_auguste/Emb_App/programme_principal_etud.c
124 124
void periph_command(char addr, short valeur);
125 125
short periph_requete(char addr);
126 126

  
127
void assser_tourelle(void);
128
void asser_roue(void);
127 129

  
128
short consigne = 450;
129
short k = 2;
130
short commande;
130

  
131
short consigne_T = 450;
132
short k_T = 2;
133
short commande_T;
131 134
short ang_T;
135

  
136
short distance_centre = 721;
137
float k_D = 1.0;
138
short commande_D;
139
short dist_mur_droit;
132 140

  
133 141

  
134 142
void main()
......
145 153
	sta_cyc(ID_acqui);
146 154
//	sta_tsk(ID_periph_rx);
147 155

  
156
	periph_command('V', 1);
148 157

  
149

  
150 158
    while(1)
151
    {
152
		LED_J=1;
153
		dly_tsk(100);
154
		LED_J=0;
155
		dly_tsk(100);		
156
	
157
		//periph_command('V', 50);
158
	
159
		
160
		ang_T = periph_requete('R');
161
		commande = k * (consigne - ang_T);
162
		periph_command('T', commande);
159
    {	
160
		assser_tourelle();
161
		asser_roue();
162
		
163 163
    }
164 164
}
165 165

  
......
169 169
}
170 170

  
171 171

  
172
void asser_roue(void){
173
	dist_mur_droit = periph_requete('U');
174
	commande_D = k_D * (dist_mur_droit - distance_centre);
175
	periph_command('D', commande_D);
176
}
172 177

  
173 178

  
174 179

  
......
176 181

  
177 182

  
178 183

  
184

  
185

  
186

  
187
void assser_tourelle(void){
188
	ang_T = periph_requete('R');
189
	commande_T = k_T * (consigne_T - ang_T);
190
	periph_command('T', commande_T);
191
}
179 192

  
180 193
void periph_command(char addr, short valeur){
181 194
	CanFrame comm;	

Also available in: Unified diff