Bonjour,
J'ai un programme qui me donne une liaison RS232 sous interruption.
La configuration est la même que la platine Elektor
Le problème est que l'interruption semble ne fonctionner qu'une fois.
Le programme me retourne 1 caractère puis le R8C se bloque.
Le Sec30.inc
.glb _UART0_Receive_int
.lword _UART0_Receive_int ; vector 18
#pragma UART0_Receive_int;
void uart_init(void)
{
/* positionnement des registres I/O */
/* Horloge synchrone du port série */
p1 = p1 | 0x10;
pd1 = pd1 | 0x10;
pd1 = pd1 & 0xdf;
u0mr= 0b00000101; // UART-Mode 8bit
u0brg = 130-1; // 9600 Bauds
u0c0 = 0b00000000; // f1SIO selectet
ilvl0_s0ric = 1;
ilvl1_s0ric = 0;
ilvl2_s0ric = 1; //prioritylevel 5
u0c1 = 0b00000100; //reception enable
asm("FSET I"); /* Interrupt enable */
}
void host_write(char* msg_string, char cNumOfChar)
{
char i;
for(i=0; i< cNumOfChar; i++)
{// This loop reads in the text string and
while(ti_u0c1 == 0); // puts it in the UART 0 transmit buffer
u0tbl = msg_string[i];
te_u0c1 = 1;
}
}
void UART0_Receive_int(void)
{
unsigned char dummy, U0_in ;
ir_s0ric = 0;
U0_in = (char) u0rbl; // read in received data
dummy = u0rbh;
re_u0c1 = 1;
host_write(&U0_in,1);
}