??? 05/07/09 08:58 Read: times |
#165130 - The serial port don't need to know what you transfer Responding to: ???'s previous message |
Would you care to post a reason for compiling this code with Keil and run it on a 805x processor, unless the processor will get real measurements from somewhere, so it will have any reason for computing any information?
Running with static input would mean that you have static output. And if the PC is sending the input and receiving the output, then this will take many times more time than if the PC computes the answers directly - an 8051 is not a good computation co-processor for a PC. If what you want to to is to transfer data to and/or from the serial port, then you should read all the excellent information about serial-port communication available in the Tutorials and Code Library sections on this site. The serial port does not know what data that is transmitted, so it isn't important that the serial code knows about your specific algorithm. Either send the data binary, or convert the values to hexadecimal or decimal form for the transmission. If you send in binary form, then you will have to do some form of framing. It would be easiest to use a char pointer that you set to the first byte of the first value you want to send. Then Send a magic byte out to signal the start of a transmission. Then send each byte of the data as two characters - the four high bits and the four low bits of the byte sent separately. At the end, send another magic marker. This means that the actual data will only use four bits of each transmitted byte. The magic markers should make use of the other four bytes, which allows your PC to synchronize and keep track of where you are in the transfer. The code is quite simple, and you should be able to figure it out with just a basic knowledge about C, and a visit to the Tutorials and Code Library sections. |