Révision 795
Ajouté par clbouillot2 il y a presque 4 ans
SP4c12.c | ||
---|---|---|
|
||
void uart0_init(void)
|
||
{
|
||
u0mr = 0x05; //configure l'UART en mode 8 bits, sans parit? et avec 1 bit de stop
|
||
u0mr = 0x05; //configure l'UART en mode 8 bits, sans parit? et avec 1 bit de stop
|
||
u0smr = 0x00;
|
||
u0smr2 = 0x00;
|
||
u0smr3 = 0x00;
|
||
u0smr4 = 0x00;
|
||
u0c0 = 0x11; //configure la fr?quence ? 20 MHz
|
||
u0brg = 0x20;
|
||
u0c1 = 0b00000101;
|
||
(pd6 & 0x0F) = 0x08 //configure la broche TX en sortie et la broche RX en entr?e
|
||
ps0 = 0x08;
|
||
}
|
||
u0c0 = 0x11; //configure la fr?quence ? 2.5 MHz
|
||
u0brg = 0x20; //configure le baud rate ? 4735 bauds
|
||
u0c1 = 0x05;
|
||
pd6_3 = 1; //configure la broche TX en sortie
|
||
pd6_2 = 0; //configure la broche RX en entr?e
|
||
pd6_1 = 0;
|
||
pd6_0 = 0;
|
||
|
||
ps0_3 = 1;
|
||
ps0_2 = 0;
|
||
ps0_1 = 0;
|
||
ps0_0 = 0;
|
||
}
|
||
|
||
|
||
void uart0_tx (char c)
|
||
{
|
||
while (ti_u0c1 != 1){
|
||
while (ti_u0c1 != 1);
|
||
u0tb = c;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
void main (void)
|
||
{
|
||
uart0_init;
|
||
uart0_init();
|
||
while (1){
|
||
uart0_tx ('A');
|
||
int i=0;
|
||
for (i=0; i<26; i++){
|
||
uart0_tx ('A'+i);
|
||
}
|
||
}
|
||
}
|
||
|
Formats disponibles : Unified diff
Questio 7 : affichage alphabet