We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everyone, I've been having some trouble getting output from my 8051. Some of the other forums haven't been of much help. I'm simply trying to send text from the 8051 to a terminal application. From the C51 example code, I have: #include <REG51F.H> #include <stdio.h> void main(void){ SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ TH1 = 253; /* TH1: reload value for 1200 baud @ 16MHz */ TR1 = 1; /* TR1: timer 1 run */ TI = 1; /* TI: set TI to send first char of UART */ while(1){ printf("Test\n"); } } As a note though, I have an 11 MHz crystal, therefore, the above should set it to 9600 baud, not 1200. When I connect my term app at 9600, 8N1, no flow control, I get absolutely nothing. For giggles, I set it to 1200, 8N1, and I get a ton of garbage. Does anyone have any recommendations on things I can try to get proper output from the chip? I've got SecureCRT (but have also tried Hyperterminal, both with the same results)... Thanks in advance for your assistance!! -Ryan
Okay, I'll whore myself again. I have several baud rate values calculated for several different crystal values in my free serial UART driver. Have a look at http://www.embeddedfw.com and look for the Free 8051 UART driver link at the bottom. I have an Excel spreadsheet I use for doing baud rate calcs. If anyone is interested I could post that too. - Mark