summaryrefslogtreecommitdiff
path: root/2004/n/asserv
diff options
context:
space:
mode:
authorschodet2004-04-24 18:19:22 +0000
committerschodet2004-04-24 18:19:22 +0000
commitb01580be0e68f12420dbaf2492d569642394a9a3 (patch)
treedf5b339b01bd3f7a6a58a16e0d85a7e38c223444 /2004/n/asserv
parent3ef78b23f7aa93ac9799d325ea164db4a731651e (diff)
Correction du problème du port série.
Supression du calcul sur interruption RB. Passage en 115200.
Diffstat (limited to '2004/n/asserv')
-rw-r--r--2004/n/asserv/src/main.c5
-rw-r--r--2004/n/asserv/src/motor.c16
-rw-r--r--2004/n/asserv/src/serial.c4
3 files changed, 3 insertions, 22 deletions
diff --git a/2004/n/asserv/src/main.c b/2004/n/asserv/src/main.c
index da49814..1188ea1 100644
--- a/2004/n/asserv/src/main.c
+++ b/2004/n/asserv/src/main.c
@@ -55,8 +55,8 @@ A1-5 B2-7 C4-5 D2-6 E0-2
/* Configuration gnrale. */
#fuses H4,WDT,WDT128,PUT,NOBROWNOUT,NOLVP
#use delay(clock=40000000)
-#use rs232(baud=38400,xmit=PIN_C6,parity=N,rcv=PIN_C7,bits=8)
-#priority RB,RDA,TBE,TIMER2
+#use rs232(baud=115200,xmit=PIN_C6,parity=N,rcv=PIN_C7,bits=8)
+#priority RDA,TBE,TIMER2
#include "motor.c"
#include "serial.c"
@@ -100,7 +100,6 @@ irq_init (void)
enable_interrupts (INT_TIMER2);
enable_interrupts (INT_RDA);
disable_interrupts (INT_TBE);
- enable_interrupts (INT_RB);
enable_interrupts (GLOBAL);
}
diff --git a/2004/n/asserv/src/motor.c b/2004/n/asserv/src/motor.c
index 2f05c3a..242ff74 100644
--- a/2004/n/asserv/src/motor.c
+++ b/2004/n/asserv/src/motor.c
@@ -221,12 +221,10 @@ motor_compute_left_pid (void)
signed long pwm;
signed long temp;
/* Rcupre les compteurs et calcule l'erreur. */
- disable_interrupts (INT_RB);
diff = motor_g_cpt_av;
motor_g_cpt_av = 0;
diff -= motor_g_cpt_ar;
motor_g_cpt_ar = 0;
- enable_interrupts (INT_RB);
motor_g_cpt += diff;
e = motor_g_vacc - diff;
/* Calcul de l'integrale. */
@@ -262,12 +260,10 @@ motor_compute_right_pid (void)
signed long pwm;
signed long temp;
/* Rcupre les compteurs et calcule l'erreur. */
- disable_interrupts (INT_RB);
diff = motor_d_cpt_av;
motor_d_cpt_av = 0;
diff -= motor_d_cpt_ar;
motor_d_cpt_ar = 0;
- disable_interrupts (INT_RB);
motor_d_cpt += diff;
e = motor_d_vacc - diff;
/* Calcul de l'integrale. */
@@ -357,13 +353,6 @@ motor_update_cpt (void)
motor_timer3_old = timer;
}
-/* Interruptions de changement de sens. */
-#int_RB
-RB_isr()
-{
- motor_update_cpt ();
-}
-
/* Interruption de PID. */
#int_TIMER2
TIMER2_isr ()
@@ -379,14 +368,11 @@ motor_main (void)
{
/* Ne fait le traitement que s'il y a eu une interruption. */
while (!motor_int_recv)
- ;
+ motor_update_cpt ();
motor_int_recv = 0;
/* Calcul du PID. */
if ((motor_pid_int & 7) == 0)
{
- disable_interrupts (INT_RB);
- motor_update_cpt ();
- enable_interrupts (INT_RB);
motor_compute_left_pid ();
motor_compute_right_pid ();
/* Information de PWM. */
diff --git a/2004/n/asserv/src/serial.c b/2004/n/asserv/src/serial.c
index 4fb27f7..784eb24 100644
--- a/2004/n/asserv/src/serial.c
+++ b/2004/n/asserv/src/serial.c
@@ -242,8 +242,6 @@ serial_send_char (char c)
{
serial_send_full = 1;
serial_send_buf_n = 0;
- c = serial_send_buf[serial_send_buf_n++];
- putc (c);
enable_interrupts (INT_TBE);
}
}
@@ -262,8 +260,6 @@ serial_unreliable_send_char (char c)
{
serial_unreliable_send_full = 1;
serial_unreliable_send_buf_n = 0;
- c = serial_unreliable_send_buf[serial_unreliable_send_buf_n++];
- putc (c);
enable_interrupts (INT_TBE);
}
}