??? 06/10/08 01:23 Read: times |
#155649 - Programming is not guesswork Responding to: ???'s previous message |
Chris said:
1 void main (void) 2 { 3 while(1) 4 { 5 EA=1; 6 i2c_isr(); 7 i2c_init(0x80, 0); 8 i2c_master_getbyte(0x03); 9 i2c_transmit(0xEE); 10 STO = 1; 11 i2c_transmit(0xDD); 12 STO = 1; 13 i2c_transmit(0xCC); 14 STO = 1; 15 i2c_transfer_finished(); 16 } 17 } Line 5: Does it really make sense to enable interrupts before you've initialized the hardware? Line 6: How could it possibly make sense to call an interrupt handler from your main program? Line 8: i2c_master_getbyte() does absolutely nothing. Why are you calling it? Line 15: i2c_transfer_finished() does absolutely nothing. Why are you calling it? Chris, once again I'll be blunt. It's clear that you've used Code Architect to cook up some code for you and then tried to use it without understanding it at all. In fact, based on your calls to i2c_transfer_finished() and i2c_master_getbyte(), I'd guess that you didn't even look at those routines. If you had, you'd have seen that they don't do anything and you wouldn't have called them. Programming is not something you can do successfully by guessing. For your own sake and that of your employer, please back up, learn the fundamentals, and stop trying to bluff your way through this stuff. It won't work. -- Russ |
Topic | Author | Date |
Hardware I2C on 8051 NXP....I'm stuck | 01/01/70 00:00 | |
divide and conquer | 01/01/70 00:00 | |
where would I find that? | 01/01/70 00:00 | |
what is a "tut file" ?? | 01/01/70 00:00 | |
FIle is in the link in first post | 01/01/70 00:00 | |
I would NEVER NEVER NEVER ..... | 01/01/70 00:00 | |
Well that's not gonna happen.... | 01/01/70 00:00 | |
looks to me as staright CodeArchitect | 01/01/70 00:00 | |
accidential double, ignore | 01/01/70 00:00 | |
Programming is not guesswork | 01/01/70 00:00 | |
blunt is fine.....and I'll say it again. | 01/01/70 00:00 | |
Forum posts and reality... | 01/01/70 00:00 | |
you will break a leg | 01/01/70 00:00 | |
does it have to be C?![]() | 01/01/70 00:00 |