??? 10/08/04 08:06 Read: times |
#78995 - RE: DAC algorithm with ADuC814 Responding to: ???'s previous message |
I think the more obvious solution here is to split the 12 bits into two groups of 6 bits then use the most significant bit to determine odd or even. 10xxxxxx odd (bits 0..5) 00xxxxxx even (bits 6..11) The 'c' code would be something like this... unsigned in tmp; unsigned char a; while(1) { if (RI) { a = SBUF; //read the char RI = 0; if (a & 0x80) //is it odd or even? { //odd tmp = a & 0x3f; } else //even { tmp |= ((a &0x3f)<<6); dacout(tmp); //write to the dac on even chars } } } How does the DAC output not work so well? In your previous post a few weeks ago, I suggested a few techniques of analysing the data. With a baud rate of 9600 baud that gives you 960 chars/s with two bytes per sample = 480 samples/sec which gives you a bandwidth of less than 240hz - a sine input of 240hz is not going to come out the other end looking the same! Copy your sampled data into Excel and draw a graph of it - I'm sure the DAC will look similar. Your current implementation will only give you 'reasonable' results to 48hz! Fine if that's all you require. |
Topic | Author | Date |
DAC algorithm with ADuC814 | 01/01/70 00:00 | |
RE: DAC algorithm with ADuC814 | 01/01/70 00:00 | |
RE: DAC algorithm with ADuC814 | 01/01/70 00:00 | |
RE: DAC algorithm with ADuC814 | 01/01/70 00:00 | |
RE: DAC algorithm with ADuC814![]() | 01/01/70 00:00 |