??? 07/31/06 09:21 Read: times |
#121380 - Sorry, you're not being clear Responding to: ???'s previous message |
Eugene, you're not making yourself clear. The others have suggested you read the datasheet. I just went to the national website and had a look at the appnote for the chip you describe - they give a clear flowchart and assembler code - its not 'c' but its the concept that is the critical part. http://www.national.com/an/AN/AN-280.pdf Have you told us what 'c' compiler you're using? Anyway... here's hint hint to get you started... /* shifts a byte out P1.0 MSB first using P1.1 as a clock #define SCLK P1.1 #define SDOUT P1.0 void shift_byte(char val) { char bitcount,tmp; tmp = val; for(bitcount=0;bitcount<8;bitcount++) { if ((tmp & 0x80) !=0) //test most sig bit { SDOUT = 1; //clock a '1' bit } else { SDOUT = 0; //clock a '0' bit } SCLK = 1; tmp<<=1; //shift the data along 1 bit SCLK = 0; } } This code shifts 8 bits out. You'll also need data in and cs port pins to control the a/d. The code to shift in the result is similar. Please don't abbreviate 'you' into 'u'. Bad manners! |
Topic | Author | Date |
Writing/Reading byte of data to/from 8051 serially | 01/01/70 00:00 | |
Outputting a Byte of serial data | 01/01/70 00:00 | |
Sorry, i forget to mention.. | 01/01/70 00:00 | |
That\'s fine, but ... | 01/01/70 00:00 | |
He says he has to output TO the 805x | 01/01/70 00:00 | |
Not Serial Port, Data Bus? | 01/01/70 00:00 | |
Did you read the datasheet? | 01/01/70 00:00 | |
If he learns Microwire, he's done, right? | 01/01/70 00:00 | |
Hmm, to make things clear, | 01/01/70 00:00 | |
Sorry, you're not being clear | 01/01/70 00:00 | |
And which 8051 derivative? | 01/01/70 00:00 | |
It does helps | 01/01/70 00:00 | |
Cannot understand... | 01/01/70 00:00 | |
I'd strongly urge you to avoid SMS abbreviations! | 01/01/70 00:00 | |
I would not | 01/01/70 00:00 | |
Has 'C' become an excuse? | 01/01/70 00:00 | |
First assembler, then 'C' | 01/01/70 00:00 | |
absolutely![]() | 01/01/70 00:00 |