??? 06/08/11 19:43 Read: times |
#182543 - No, it isn't Responding to: ???'s previous message |
It relies upon a particular compiler - but you haven't stated what compiler.
#define I2C_DELAY 0x0F // For delay i2c busWhat delay, exactly, is that supposed to produce? It relies upon a certain clock frequency, and a certain number of clocks per instruction - neither of which you've stated. void I2C_delay(void) { unsigned char i; for(i=0; i<I2C_DELAY; i++); }The folly of HLL timing loops has already been explained - twice: http://www.8052.com/forum/read/182476 http://www.8052.com/forum/read/182488 Note also that this loop is likely to be optimised-out #define sda P0_0 // Serial data pin #define scl P0_1 // Serial clock pin #define set_sda (P0_0=0x01) // Set Serial data pin #define set_scl (P0_1=0x01) // Set Serial clock pin #define clr_sda (P0_0=0x00) // Clear Serial data pin #define clr_scl (P0_1=0x00) // Clear Serial clock pin It is conventional to use UPPERCASE for 'C' macros. Why do your set/clear macros not use your sda and scl definitions? set_scl; // Set SCL With a name like set_scl, a comment, "Set SCL" adds no value. #ifndef IC2_h #define IC2_hWhat is that for? |
Topic | Author | Date |
Help me ? 89C52 interfacing with EEPROM 24C02 | 01/01/70 00:00 | |
Do *not* use 'for' loops for delays! | 01/01/70 00:00 | |
100k is the upper limit | 01/01/70 00:00 | |
HLL delay loops - just don't do it! | 01/01/70 00:00 | |
that may be difficult | 01/01/70 00:00 | |
but there is a way | 01/01/70 00:00 | |
See if this code is of any help! | 01/01/70 00:00 | |
I doubt it very much | 01/01/70 00:00 | |
No, it isn't | 01/01/70 00:00 | |
doubts 1,2,3 | 01/01/70 00:00 | |
code for 24c02 wih 89c52 | 01/01/70 00:00 | |
Do *not* use 'for' loops for delays! | 01/01/70 00:00 | |
code? | 01/01/70 00:00 |