Last change
on this file since 186 was
186,
checked in by mulligan, 11 years ago
|
Added C code to write to SBUF SFR for Roberto.
|
File size:
490 bytes
|
Rev | Line | |
---|
[186] | 1 | #include "mcs51reg.h" |
---|
| 2 | |
---|
| 3 | int main() |
---|
| 4 | { |
---|
| 5 | SCON = SCON | 0x40; // Change serial port mode to mode 1 |
---|
| 6 | TMOD = TMOD | 0x20; // Configure timer 1 to mode 2 (8 bit autoreload) |
---|
| 7 | TH1 = 0xFD; // Baud rate to 19,200 with ~11mhz clock |
---|
| 8 | PCON = PCON | 0x80; // PCON.7 set to double baud rate (needed?) |
---|
| 9 | TI = 0x00; // Clear the transmission bit |
---|
| 10 | SBUF = 5; // Write 5 to the serial buffer |
---|
| 11 | while(!TI) { } // Wait until the data has been transmitted |
---|
| 12 | return 5; |
---|
| 13 | } |
---|
| 14 | |
---|
Note: See
TracBrowser
for help on using the repository browser.