I am doing a project and in that project i am using one MAX232 but with multiple Microcontrollers i know that i cannot use RS-232 to multiple Microcontrollers but i am using MAX232 to convert the RS-232's 23V to TTL (5V) and so as the RS232 is converted to TTL so i think that it will work for multiple Microcontrollers (am i right?) well this is my stratigy ...
but my main task is that i want to send a HexaDecimal no through the Serial port so that the approriate Microcontroller will responce .... so i have coded some code but as i cant see the value came into SBUF in keil so could any one help me ?
this is the sample code i want to do inside the Recive interrupt but its not the exact one because there might be some variations
int i=1;//global variable which is to be compared void xyz (void) interrupt 4 { if (R1) { if (SBUF==i) { /*My code probabally the Printf statememt*/ } } }
"using MAX232 ... the RS232 is converted to TTL so i think that it will work for multiple Microcontrollers (am i right?)"
No - you are wrong.
The MAX232 does not provide a bus interface - that's what you need.
You need some sort of scheme using, for example, open-collector or tri-state drivers. And then some scheme to ensure that you can never have more than one unit transmitting at a time, or some sort of "collision" detection & retry scheme to recover from it.
If you gave a clearer description of what you're actually trying to achieve, people would be able to give more specific help...
"but my main task is that i want to send a HexaDecimal no through the Serial port so that the approriate Microcontroller will responce"
Actually, that's an implementation detail rather than your "main task"!
Have you looked at the 9-bit Multiprocessor mode of the 8051 UART?
int i=1; //global variable which is to be compared
Are you sure that you want the numeric value 1 (0x01), or do you really mean the character '1' - ASCII code 0x31?
"i cant see the value came into SBUF in keil"
What have you tried?
Have you run this in the simulator?
sounds like 9 bit mode
Well sir all of your replies are very helpfull to me but my problem is that i am unable to find the approriate C code for multiprocessor so that i thought that i can use the 8-bit Hexadecimal code such as
int id=0x01;
and whenever all the Microcontroller will get the byte sended from the Computer then only the Microcontroller whose id will be same as the byte recived then that Microcontroller will response ... (that's why i have subjected the Thread as "Lame Multiproccesing") because i am unawair of that 8051's 9-bit mode....
well thanks for all your comments but i think that i need the good link for 9-bit C code BADLY.
""i cant see the value came into SBUF in keil"
Have you run this in the simulator?"
Yes sir i know that i cant see it in simulator.... because you have told that in another thread.
You CAN see received bytes. you can not see transmitted bytes.
Eriok
See ">http://www.keil.com/forum/docs/thread2882.asp
"whenever all the Microcontroller will get the byte sended from the Computer then only the Microcontroller whose id will be same as the byte recived then that Microcontroller will response"
Yes, that's exactly what the Multiprocessor mode does for you! If, as mentioned in the above links, you use a derivative with the Enhanced UART, then the address recognition can all be done automatically for you by the hardware with no software overhead!
"i am unawair of that 8051's 9-bit mode..."
Read the above-mentioned links!
It is also in the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
" i think that i need the good link for 9-bit C code BADLY."
No, you need to understand first - then you can start thinking about code!
Actually, the Simulator has separate VTREGs for the transmit and receive halves of SBUF - so you can see them both in the simulator!
Look-up "VTREG" in the uVision Manual...
It would be a Really Bad Idea to call printf from inside your ISR...!
:-0
Just out of curiosity, why do you call this "Lame" Multiprocessing?
Lame because i am developing my own lame ideas for multiprocessing ... (its like i want to design a BMW from my own OLD Model TOYOTA) and my ideas are not so good that's why the word lame is used
YOu have written that it would be really bad idea to call printf function from ISR so could you please tell me how to send multiple charecters or integers from SBUF ?
http://www.keil.com/download/docs/200.asp