hi members... i'm programming assembler and likewise c. a practical training force me to write assembler in c. the serial port names P3.1 and i can send every time 8 bit (2bit = start- and stopbit and the last 6 bit's are data). i must abide the exactly speed (baudrate) for my pc and microcontroller. in assembler is that very easy because i can use the cycle's. i have realized the delay with loops in c but the loops are very inexactly! i've got the answer to use the processortime or related. How!?!?! thank's for you sympathy yours sincerely nick
Are you trying to communicate with a 'normal' RS232 serial port on a 'normal' PC?
Reading the original post, it seems that he is trying to implement RS232 baud timings using delay loops. Not easyily done in 'straight' C... The obvious suggestion would be to use a UART (then the conversion from assembler to C would be fairly simple), or if the UART is banned (in the assignment), then use a timer interrupt.
yes i'm working with rs232! thank for you sympathy!
"yes i'm working with rs232" I assume that means you are communicating with a 'normal' PC serial port? In that case, use the UART. You don't need to bit bang. If it is an assignment that forbids use of the UART then post your complete, compilable code and someone will probably offer some help.