??? 12/18/09 19:46 Read: times |
#171743 - maybe Responding to: ???'s previous message |
What compiler does? See Your assembler listing, generated by Your C compiler.
I suppose You will see: void send_i2c_data //nothing ( // nothing, but remember "unsigned char *str "//this is pointer, ok R0 is good pointer ) { //nothing "unsigned int buffer_count = 0;" //ok R7 is good counter mov r7,#0 //still nothing , " unsigned char i2c_status;" - but declaring inside routine/function // is usefull?? , is visible outside ? RSEG DATA i2c_status: ds 1 ;assuming is not defined in stack, is visible // while ((*i2c_buffer = *str)!='�') // { // str++; // i2c_buffer++; // buffer_count++; // } // i2c_status = i2c_transmit(0x60); mov r1,i2c_buffer this_loop: mov a,@r1 mov @r0,a inc r0 inc r1 mov a,r2 ;You think this line is false?Why? Compiler (i saw 10 years ago) uses R2 to ;pass/receive char parameters. I do not use C, but i never read that "a=b" is function. xrl a,"n" jnz this_loop mov r2,#0x60 ; pass char parameter to function call i2c_transmit mov i2c_status,r2 } regard, hope with help |
Topic | Author | Date |
Some help with copying strings in C (again) | 01/01/70 00:00 | |
Blast. | 01/01/70 00:00 | |
? | 01/01/70 00:00 | |
Crunched function | 01/01/70 00:00 | |
maybe | 01/01/70 00:00 | |
= vs == | 01/01/70 00:00 | |
ok | 01/01/70 00:00 | |
'\0' | 01/01/70 00:00 | |
just for record | 01/01/70 00:00 | |
Both are ok. | 01/01/70 00:00 | |
A warning - not an error | 01/01/70 00:00 | |
Yes. Should have said "warning" | 01/01/70 00:00 | |
but | 01/01/70 00:00 | |
Assign always spreads to the left, but mind the data type | 01/01/70 00:00 |