Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "C8051F020.h"
- #include "c8051F020_SFR16.h"
- #include "FO_M1__Structures_COMMANDES_INFORMATIONS_CentraleDeCommande.h"
- int i=0;
- char chaines[20];
- //22.184 MHz
- void Oscillator_Init_Osc_Quartz()
- {
- int i = 0;
- OSCXCN = 0x67; // Config de l'horloge externe - Quartz > 6,7 MHz
- for (i = 0; i < 3000; i++); // attente stabilisation Fosc quartz
- while ((OSCXCN & 0x80) == 0); // validation stabilité du quartz
- OSCICN = 0x0C; // Commutation sur oscillateur externe
- // L'oscillateur n'est pas stopp
- }
- //
- //
- void Config_Interrupt(){
- EA=1;
- ES0=1;
- }
- //
- //
- void Config_UART0()
- {
- TR1=0;
- XBR0 |=0x04;
- XBR2 |=0x40;
- CKCON |= 0x10; //T1M =1
- TMOD |= 0x20; //Timer 1 auto reload 8 bit
- SM00=0;
- SM10=1;
- SM20=0;
- REN0=1;
- PCON &= ~(0x40); // SSTAT0 = '0'
- PCON |= 0x80; // SMOD0 = '1' : disables the divide-by-two function of the UART0 baud rate
- TCLK0=0; //Transmit Clock Flag for UART0. 0 car on utilise Timer 1
- RCLK0=0; //Receive Clock Flag for UART0.
- TH1=0xB8;
- TR1=1;
- RI0=0;
- TI0=0;
- }
- //
- //
- void Decodage() interrupt 4 {
- char c;
- chaine
- c=SBUF0;
- RI0=0;
- }
- //
- //
- void main (void) {
- COMMANDES chaine;
- Oscillator_Init_Osc_Quartz();
- Config_interrupt();
- Config_UART0();
- }
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement