Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- #include "DS89C4xx.h"
- void WaitForEndOfTransmit(void);
- int i = 0;
- char array[] = "TEST";
- int main()
- {
- SCON0 = 0x50; // Selectione mode 1, 8-bit avec reception
- TMOD = TMOD | 0x20; // timer 1, mode 2, 8-bit auto reload
- TH1 = 0xFF; // a 11.0592MHz: FA=4800,FD=9600,FE=14400 et FF=28800
- PCON = PCON | 0x80; // Le bit SMOD = 1 pour vitesse * 2 du port serie
- ET1 = 0; // Pas interrupt on Timer 1 (IE.3)
- TR1 = 1; // Active le timer 1
- TI_0 = 0; // Transmit Flag. A 0 pour ne pas generer Int. (SCON0.1)
- RI_0 = 1; // Receive Flag. Mis a 1 pour generer Int. (SCON0.0)
- ES0 = 1; // Active l'interruption du port serie (IE.4)
- i = 1;
- SBUF0 = 'T';
- WaitForEndOfTransmit();
- SBUF0 = 'E';
- WaitForEndOfTransmit();
- SBUF0 = 'S';
- WaitForEndOfTransmit();
- SBUF0 = 'T';
- WaitForEndOfTransmit();
- while(1);
- return 0;
- }
- void WaitForEndOfTransmit(void)
- {
- while(!TI_0);
- TI_0 = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement