printf() not working , peculiar situation
From: som (som_at_london.com)
Date: 07/10/04
- Next message: Ralph Mason: "2-4 inch Color LCD's"
- Previous message: Mike Fields: "Re: Synchronizing camcorder with telemetry"
- Next in thread: Meindert Sprang: "Re: printf() not working , peculiar situation"
- Reply: Meindert Sprang: "Re: printf() not working , peculiar situation"
- Reply: Neil Kurzman: "Re: printf() not working , peculiar situation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 9 Jul 2004 21:16:53 -0700
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 .
i would like to add that :
my oscillator frequency :11.059 mhz ;
my baud rate (of hyperterminal also): 9600 bps ;
software:evaluation version of KEIL
H/W :ATMEL AT89C51
The code size is well below the 4K ram size of 89c51 .
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,#52h ;
repeat1:
mov a,#'@'
call _xmit_byte
jmp repeat1
;----------------------------------------------------------------
_XMIT_BYTE: MOV SBUF,A ;
JNB TI,$ ;wait till byte is transmitted
CLR TI ;
RET
;----------------------------------------------------------------
end
plz help .ASAP
with regards
Som
- Next message: Ralph Mason: "2-4 inch Color LCD's"
- Previous message: Mike Fields: "Re: Synchronizing camcorder with telemetry"
- Next in thread: Meindert Sprang: "Re: printf() not working , peculiar situation"
- Reply: Meindert Sprang: "Re: printf() not working , peculiar situation"
- Reply: Neil Kurzman: "Re: printf() not working , peculiar situation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]