Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Two MicroControllers

Status
Not open for further replies.
Have you though about flow control. When the MC is going to be too busy it sends an XOFF. When free to receive data it sends XON. Could also be done with hardware handshake.

You only need to do this for the DTMF generation. A keyboard scan can be interrupted without any problem and the LCD should be ok too.
 
Last edited:
I don't understand why 2 pics are required. You want to read a keypad or two, write to a display and produce a tone. Easily done with a single pic and, if this involves a human typing then you can slow the pic down to 32K.

Maybe you should describe what you are trying to achieve.

Mike.
 
it is 3 atmel 8051 not pic and it s a project :S not in my hand.
Excuse me 3v0 what do u mean by xon and xoff, as i think if dat would be connect to interrupt , yea i thought about that but there is already some interrupts in the system :S and i cant keep watching a bit and leave all the program .
 
XON and XOFF are the names of two ASCII Control Characters. They are also known as ^Q or DC1, and ^S or DC3. As 3VO said you use them on a serial port to throttle a fast talker.

When a transmitting station receives an XOFF, it completes any operations in progress, and stops transmitting. It stays in this state until it receives an XON. Then it picks up right where it left off as if there had never been a long pause.

See the following link for more information:
https://en.wikipedia.org/wiki/ASCII
 
Eng.Remon said:
it is 3 atmel 8051 not pic and it s a project :S not in my hand.
Excuse me 3v0 what do u mean by xon and xoff, as i think if dat would be connect to interrupt , yea i thought about that but there is already some interrupts in the system :S and i cant keep watching a bit and leave all the program .

I am going to ignore the XON XOFF question for now in that PapaBravo has sent you in the right direction.

If you know the following please forgive me. It may be a language thing but lets make sure we are talking about the same thing.

I do not know your system but I do not see anything other the the UART that requires it to be interrupt driven.

What are you talking about watching a bit. That would be polling, you check or poll a bit periodically to see if it changed (as in a char has arrived). That is what you do not want to do.

An interrupt is when some condition (a character arriving) causes the program to stop what it is doing and handle the interrupt (move the char from the UART) then return to what it was doing when interrupted. As long as the code to handle the interrupt is short/fast most other code never knows it was interrupted. The software does not check any bits, this is done by the CPU hardware which causes the interrupt code to be executed at any random spot in you normal code.

So you write normal code to do the DTMF, Keyboard etc. You write an interrupt routine to move data/chars from the UART to an input buffer. You main program checks the input buffer to see if it has any data.

If the above is not good enough. The have the main program send a XOFF to the sending processor prior to generating a DTMF tone and then send a XON when done generating the tone. That will cause the sender to not send any data while you are doing DTMF.
 
ok lets declare the system : all uc Are 80c51 Atmel
uc1: sensors are connected to it (heat, ir, smoke, pressure) which leads to 6 actions . which usually send to the main controller to take action and make the other uc make a call
uc2: the main microcontroller which is connected to a keybad and lcd and also should get actions from uc1 and send to uc3 to make a call or whatever.
uc3:the dtmf uc which make calls or receive calls and also deals with the main controller from the case of setting system on , off or armed (some states)
So there is data transefer between the 3 uc
from uc1 to uc2 it is 8 bits,
from uc3 to uc2 it is 8 bits,
and reverse is da same uc2 to uc1 or uc3 is 8 bits.
Also each one would be running on different speed. so they are asynchronous.

hope that code help alil.
the problem is the transfer time not how to transfer, coz all what i m afraid from is if the uc1( sensor microcontroller ) got an alarm from the ir so it gets out the action of it. suppose it 10110010 and then it finds over heat so it will gets out 10011000. So i m afraid of override of data. as it would not be synchronous with uc1.

is what i think is wright?!
thanks for ur care and help guys
 
what i thought about is something like a batch between each 2 uc.
just to hold data untill the one reads it then would be deleted, is dat good !? or what?
 
Eng.Remon said:
what i thought about is something like a batch between each 2 uc.
just to hold data untill the one reads it then would be deleted, is dat good !? or what?

This is exactly what UART does for you!

**broken link removed**
 
What I said in my last post will work for you but you can add msg level checking to make it better.

To ensure that a msg/signal gets through you can have the receiver echo back the msg/signal to the sender. If the echo does not come back in a reasonable period of time then then msg/signal is resent.
This closes the loop... because the sender just keeps banging at the receiver till the msg is acknowledged.

Non of this is new. It is common place.
 
To be honest it seems a fairly trivial requirement?, you could use interrupts if you wanted?, but polling would be many, many times faster than required - it's really a very slow application - as are most 'real world' applications for micro-controllers. It could all quite easily be done by one micro-controller anyway, no need for using three?.
 
there is alot of interrupts used with the keybad and the sensors , and it is 8051 so just 2int in each uc ,
Can u give me more informations with UART or something applied wid!?
thnx
 
If you're using a lot of interrupts you perhaps should reconsider your design?, interrupts can be VERY useful, but that doesn't mean you need to use them for everything - generally it's a bad idea to do so!. There certainly seems no requirement for using interrupts on the sensors, polling would be simpler, and more than fast enough (probably thousands of times faster than required).
 
u r right in the sensors but think alil about the main uc it is connected to keypad so i have one int in it . but we back to the idea of asynchronous time mechanism between them .
 
Eng.Remon said:
u r right in the sensors but think alil about the main uc it is connected to keypad so i have one int in it . but we back to the idea of asynchronous time mechanism between them .

Just a UART, either hardware or software, presumably 8051's have hardware UART's?, if not software ones are easy to write.
 
sorry, but really i dont know what is uart unless what typed here , so can u be more explain of how i should get it if an ic or how i could program it if it is in the Atmel . !!!
 
Eng.Remon said:
sorry, but really i dont know what is uart unless what typed here , so can u be more explain of how i should get it if an ic or how i could program it if it is in the Atmel . !!!

UART is short for 'Universal Asyncronous Receiver Transmitter', a serial port, most PIC's have them, and it's easy to create one in software if they don't. Presumably there's pleny of 8051 examples available?, check for UART, serial port, or RS232.
 
How close are the chips together? If they are in close proximity you may be better off with somthing other the RS232. That is unless that has been choosen fo you. If you use RS232 U2 will need to have 2 UARTS. If needed the second one can be done in software aks bit banging.

This is a school project? I do not understand why you have been asked to do communication without first having studied it.
 
Last edited:
lol it is a graduation project, So u make things u know and what u dont should know too. dats it any way this is a security system and the chips are not together or close
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top