Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/12/04 04:21
Read: times


 
#81068 - RE: UART 9-Bits Mode Operation
Responding to: ???'s previous message
Thanks and sorry I had some miss typing.
Here is a refined DAC routine and I got about 80% of accurate restored wave.
About another 20% data was wrongly plotted by nine and flag branch. Why is it?
Thank you very much.
////////// DAC ROUTINE //////////
void dac(void) {
	if(RI) {
		a = SBUF;	// read from UART
		nine = RB8;
		RI = 0;

		if(nine) {	// receive HHHHLLLL
			high = (a&0xF0) >> 4;	// high: 0000HHHH
			low = (a&0x0F) << 4;	// low: LLLL0000
			flag = 1;
		}
		else if(flag) {	// receive LLLLHHHH
			low |= (a&0xF0) >> 4;	// low: LLLL0000 | 0000LLLL = LLLLLLLL
			DAC0H = high;	// output high 4bits
			DAC0L = low;	// output low 8bits			
			high = a&0x0F;	// high: 0000HHHH
			flag = 0;
		}
		else {	// receive LLLLLLLL
			low = a;	// low: LLLLLLLL
			DAC0H = high;	// output high 4bits
			DAC0L = low;	// output low 8bits
		}

	}
}


The images shows you signals of yellow original (100Hz), green serial, and pink restored. Pink restored looks having some problesm.

List of 12 messages in thread
TopicAuthorDate
UART 9-Bits Mode Operation            01/01/70 00:00      
   RE: UART 9-Bits Mode Operation            01/01/70 00:00      
   RE: UART 9-Bits Mode Operation            01/01/70 00:00      
      RE: UART 9-Bits Mode Operation            01/01/70 00:00      
         RE: UART 9-Bits Mode Operation            01/01/70 00:00      
            RE: UART 9-Bits Mode Operation            01/01/70 00:00      
            RE: UART 9-Bits Mode Operation            01/01/70 00:00      
   RE: UART 9-Bits Mode Operation            01/01/70 00:00      
   RE: UART 9-Bits Mode Operation            01/01/70 00:00      
      RE: UART 9-Bits Mode Operation            01/01/70 00:00      
         RE: UART 9-Bits Mode Operation            01/01/70 00:00      
            RE: SPI vs UART 9-Bits Mode            01/01/70 00:00      

Back to Subject List