Revision 152 trunk/tp_info6/Emb_App/programme_principal_etud.c

View differences:

programme_principal_etud.c
130 130
} CanFrame;*/
131 131

  
132 132
short alpha;
133

  
133
short erreur;
134
short cmd;
134 135
void rot_tourelle()
135 136
{
136 137
	CanFrame comm;
137 138
	
138 139
	comm.data.id = 'T';
139 140
	comm.data.rtr = 0;		//Indique une ecriture
140
	comm.data.val = 160;
141
	comm.data.val = cmd;
141 142
	snd_dtq(CanTx, comm.msg);
142 143
	
143
	dly_tsk(100);
144
	/*dly_tsk(100);
144 145
	comm.data.val = 120;
145
	snd_dtq(CanTx, comm.msg);
146
	snd_dtq(CanTx, comm.msg);*/
146 147
	}
147 148

  
148 149
void pos_tourelle()
......
156 157
	rcv_dtq(CanRx, &reponse.msg);
157 158
	alpha = reponse.data.val;
158 159
	} 
160
	
161
void Asserv0()
162
{	
163
	short consigne=450;
164
	
165

  
166
	short k=1;
167
	
168
	erreur = consigne - alpha;
169
	cmd = erreur*k;
170
	//snd_dtq(CanTx, cmd.msg);
171
	}
159 172

  
160 173
void main()
161 174
{
......
176 189
		LED_J=1;
177 190
		dly_tsk(100);
178 191
		LED_J=0;
179
		dly_tsk(100);
180
   		rot_tourelle();
192
		dly_tsk(100);
181 193
	    pos_tourelle();
194
		Asserv0();
195
		rot_tourelle();
182 196
		 }
183 197
   	
184 198
}

Also available in: Unified diff