??? 04/08/11 15:59 Read: times |
#181782 - Thinking before coding Responding to: ???'s previous message |
As Andy noted, thinking is a must before coding.
A typical scheme is Analysis --> Development/Test --> User acceptance. To store the received characters to a buffer eg in iRam you have to specify a start address available and not occupied by other variables or procedures. Setup the pointer register to point to the first available address. After storing the first character, increase the poiner by one and wait for the next character until the number of received characters are equal to the desired length of the defined packet structure. Of course the Stack Pointer should be setup above of all the iRam used locations. The default SP value at Reset for 8051 MCUs is 0x07 which means the first byte pushed on stack would be stored in iRAM location 0x08 (++SP). The indexed method access of iRam is made using @Ri {@R0, @R1) like mov A, @R0 or mov @R0, A. Such approach is very well pointed out on the online tutorial of www.8052.com or the book you mentioned. [Note] Because of the international character of the site please respond in english so all members or viewers can benefit from the discussion. K.L.Angelis |