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.
dear friends i have a peculiar situation at hand . i am trying to dump some message to my serial port and see it through my dummy terminal . before that i tried a simple LED toggling , it worked fine . for that the code i had written is : #pragma small #include<AT89X51.h> #include<stdio.h> int main() { TMOD = 0x20; // The timer set to 8 bit auto reload timer TH1 = 0xFD; // Higher byte of timer1 set to FD or reload value set to FD TL1 = 0xFD; // Lower byte of timer1 set to FD SCON = 0x52; // The serial Controller is configured TR1=1; // Timer 1 run flag set while(1) { printf("Hello World \n"); // data sent to serial port for displaying } return 1 ; } so the problem is that on my hyperterminal i dont get anything . but in debug window ,in the serial watch window , i am able to see the output . but after burning the code into the chip and subsequently in the hyperterminal i am not able to . i am not able to follow where lies the problem . in the c51 primer exact code has been given , but that too does not work . plz help .ASAP with regards Som
What's your oscillator frequency? Do the baudrates of your PC and your 8051 hardware match? Dejan
hi dejan, thanx for replying .your question is good. my oscillator frequency is 11.0592 mhz, and the baud rate is 9600 bps as is evident on the code . the hyperterminal has been set at the same frequency i.e 9600 bps . an interesting thing is that , with the same hardware i am able to get on my hyperterminal output when i use assembly code(given below). just try if you can solve my problem . is there any setting on the simulator /complier / Hex file that i am missing out ??? code: cseg at 0000H org 0000h ajmp start org 0040H start: mov sp,#40H mov r0,#07Fh back: mov @r0,#00 djnz r0,back mov th1,#0FDh ;configure serial port as 9600/8bit/No mov tmod,#00100000b setb tr1 mov scon,#50h ; repeat1: mov a,#'@' call _xmit_byte jmp repeat1 ;---------------------------------------------------------------- _XMIT_BYTE: MOV SBUF,A ; JNB TI,$ ;wait till byte is transmitted CLR TI ; RET ;---------------------------------------------------------------- end
Are you using eval.version of the tools? Which exact derivate of the 8051 are you using? Dejan
hi dejan i am using evaluation version of KEIL and ATMEL AT89C51 . som
Have you checked your M51 file - is the resulting code larger than 4K your processor has? Eval.versions offset code to disable usage of smaller derivatives...Assembler code is much smaller than C,so that can be the reason... Dejan
an interesting thing is that , with the same hardware i am able to get on my hyperterminal output when i use assembly code(given below). But the SCON setting in the C code (0x52) doesn't match that of the assembly code (050h). Also, you do things in a different order in the assembly program and in the C program. Jon
i have changed the SCON settings to 52h in the assembly code , and its working fine . but still my problem remains unresolved . mohit can you have look at this .
hey dejan my code is working fine but only when i use a TI MSC1210 with 32K of RAM . it seems that my AT89C51 is running out of memory . i had a look at my hex file the code does not start at 00H . is there any way i can select the memory location from which my code will start from ??? with regards som
Evaluation version ALWAYS loads C programs starting at address 0x400 - only way to circumvent this is to buy the software... Dejan
hey dejan thanx again !!! is there something like i can set the starting address at 00h i can do with the help of inline assembly . how does one include assembly codes in the c file ?? i have come up to the level of #pragma asm #pragma endasm after that when it comes up with SRC directives i am all confused !! can you guide me plz with regards Som
How about reading a manual? I know that it's painfull, but I did it and I survived :) Dejan
"is there something like i can set the starting address at 00h i can do with the help of inline assembly." Not with the Free Evaluation version of the tools! See: http://www.keil.com/demo/limits.htm and: http://www.8052.com/forum/read.phtml?id=73943&top=73943