Advertisement
smartel99

asdf

May 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <string.h>
  4. #include "DS89C4xx.h"
  5.  
  6. void WaitForEndOfTransmit(void);
  7. int i = 0;
  8. char array[] = "TEST";
  9.  
  10.  
  11. int main()
  12. {
  13.  
  14.   SCON0 = 0x50;        // Selectione mode 1, 8-bit avec reception
  15.   TMOD  = TMOD | 0x20; // timer 1, mode 2, 8-bit auto reload
  16.   TH1   = 0xFF;        // a 11.0592MHz: FA=4800,FD=9600,FE=14400 et FF=28800
  17.   PCON  = PCON | 0x80; // Le bit SMOD = 1 pour vitesse * 2 du port serie
  18.  
  19.   ET1  = 0;            // Pas interrupt on Timer 1  (IE.3)
  20.   TR1  = 1;            // Active le timer 1
  21.  
  22.   TI_0 = 0;            // Transmit Flag. A 0 pour ne pas generer Int. (SCON0.1)
  23.   RI_0 = 1;            // Receive Flag. Mis a 1 pour generer Int. (SCON0.0)
  24.   ES0  = 1;            // Active l'interruption du port serie  (IE.4)
  25.  
  26.  
  27.   i = 1;
  28.   SBUF0 = 'T';
  29.   WaitForEndOfTransmit();
  30.   SBUF0 = 'E';
  31.   WaitForEndOfTransmit();
  32.   SBUF0 = 'S';
  33.   WaitForEndOfTransmit();
  34.   SBUF0 = 'T';
  35.   WaitForEndOfTransmit();
  36. while(1);
  37.   return 0;
  38. }
  39.  
  40. void WaitForEndOfTransmit(void)
  41. {
  42.     while(!TI_0);
  43.     TI_0 = 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement