I have a very simple but annoying problem. I use printf () in my code and either on Keil or Proteus simulations it works. However, when I load this code to my microcontroller, which is DS89C450, it does not work.I also add the putchar.c and getkey.c to my source code. Characters, observed on Terminal Emulator are dots and squares and sometimes endless loops. The baud rate is correct. I test it by sending characters via SBUF0. The code is right here.
#include <DS89C4xx.H> #include <stdio.h> void main (void) { SCON0=0x50; TMOD=0x20; TH1=0xFC; //9600 bps with 14.7456 MHz crystal TR1=1; TI_0=1; while (1) { printf ("test\n"); }
you saved it as "PUTCHAR2.C"? you need to save it as "PUTCHAR.C" in your project directory.
No, I think that's wrong:
The name of the file shouldn't matter - it's the name of the function that's important (also its return type & parameter types).
[...] it's the name of the function that's important [...]
Depends a bit on what file name the project file mentions :)
I think i skipped something and that is it: I changed putchar but printf() works with putchar and _getkey so i have to change _getkey by swapping SBUF with SBUF0 and RI with RI_0 AND TI with TI_O too. I have the equipments at firm. So I'm going to try this Monday. If it wouldn't work, I acquaint you with that.
P.S: Thank you all for your care. I hope it works.. :)