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.
my problem is i want to send data to the serial port without using printf, this is because i want to read data of the serial port to use in another application. but using printf takes too long to run as i want my program to run at a speed less than 1mS. any help as soon as possible would be very helpfull??????????
Try putchar and puts. Note that you can modify the implementation of putchar to make your serial I/O buffered and interrupt-driven. - Mike
Look in the downloads area for an example of interrupt-driven serial IO; Mark Odell has recently posted an interrupt-driven serial IO driver in this very forum. There is nothing to stop you writing direct to SBUF!!
what i want to do is put a variable "temp" onto the serial port so i can read it from there using labview. its written in C so what code do i use?? putchar(" temp" ??????????????
As Andrew said, see my UART driver, written in C, that writes data to the serial port. All you need to do is "override" putchar() and _getket(). Keil's printf and getchar functions will then use your versions of putchar and _getkey. UART driver at http://www.embeddedfw.com (bottom of page). - Mark
"what i want to do is put a variable "temp" onto the serial port" What is temp - char? int? pointer? string? ... If you find that printf is too cumbersome, you will need to write your own routines to suit your specific requirements; eg, * write a byte from XDATA space in hex; * write an int from DATA space in signed decimal; etc, etc...
Hi: Maybe you can write a concise "printf" function instead of the formerly "printf" function
Actually, it's a C question. putchar(temp) would actually work if temp was a char. If you want to learn how to send data without using printf but using putchar only, read any book on C. - Mike
"Maybe you can write a concise "printf" function instead of the formerly "printf" function" Yes, that's what I meant earlier when I said, "If you find that printf is too cumbersome, you will need to write your own routines"
Hi, You may enable transmission interrupt(ti=1) and send one byte to SBUF directly in your interrupt service routine. I think it is fast enough.