??? 09/15/05 22:01 Read: times |
#101149 - must be like this? Responding to: ???'s previous message |
the master only sends and the slave only recives that's because i've used the same buffer for both.
enviar_comando is the function that must start the transmition. void puerto_serial_event() interrupt 4{ if(TI==1){ //if transmition occurs TI=0; //clears TI if (trama[ind_trama]!=0) SBUF = trama[ind_trama]; index++; } if (RI==1){ //if reception occurs RI=0; //clears RI if(RB8){ SM2=0; //data mode 2 } else{ if(ind_trama>4){ ind_trama=0; } trama[ind_trama]=SBUF; ind_trama++; SM2=1; //data mode 1 } } } void enviar_comando(unsigned char direccion, unsigned char comando, unsigned char parametros[3]){ unsigned char i; ind_trama=0; TI=1; SBUF=direccion; while(TI==1); SBUF=comando; while(TI==1); for(i=0;i<3;i++){ trama[2+i]=parametros[i]; while(TI==1); } } thanks |
Topic | Author | Date |
Serial communication between 2 at89c52 | 01/01/70 00:00 | |
I had a quick look and since I am not | 01/01/70 00:00 | |
pic? | 01/01/70 00:00 | |
again | 01/01/70 00:00 | |
re your ISR | 01/01/70 00:00 | |
i've modified the ISR | 01/01/70 00:00 | |
get it going with a PC at one end that g | 01/01/70 00:00 | |
i'll try 2 do that | 01/01/70 00:00 | |
transmit | 01/01/70 00:00 | |
sorry | 01/01/70 00:00 | |
No, do it in the interrupt | 01/01/70 00:00 | |
must be like this? | 01/01/70 00:00 | |
should be | 01/01/70 00:00 | |
thanks | 01/01/70 00:00 | |
NO | 01/01/70 00:00 | |
problems again, pls help me | 01/01/70 00:00 | |
still don't get it![]() | 01/01/70 00:00 | |
with only two processors why are you con | 01/01/70 00:00 | |
i've said | 01/01/70 00:00 | |
then this is a bad title. | 01/01/70 00:00 |