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.
Almost every 8051 has at least one onboard UART or Serial Port. If you need more there is the very capable MAX3100 family of SPI UARTs, or you can build one in software. I agree with Nigel, by the way, that you dont need to use interrupts for everything especially keypads. I also agree that multiple processors are not indicated for this straightforward application. You do not appear to have the slightest justification for using more than one processor.
 
Papabravo said:
...I also agree that multiple processors are not indicated for this straightforward application. You do not appear to have the slightest justification for using more than one processor.

I think the idea is that he needs to have the sensors a distance from the actual controller/monitor. I am not sure what the justification for the 3rd is. Perhaps it is just to show that they know how to make 3 processors communicate.

But I think that RS232 is a poor choice. A RS485 network would be better then a point to point link in that additional processors/sensor could be added anywhere. I do not think these guys are up to it.
 
Papabravo how could connect the keybad witout interrupts ? how u gona know when a button is hit?!.
exactly 3vo & the 3rd uc is for the dtmf and hang up circuits which deal wid them.
sorry 3vo i dont understand that:
A RS485 network would be better then a point to point link in that additional processors/sensor could be added anywhere. I do not think these guys are up to it.
 
Nigel has written a series of tutorials for the PICs that include one on polling keyboards. Take a look at it. See link in his signature.

RS232 serial links two devices together.

A RS485 network allows many devices to talk to each other over the same pair of wires, but only one device can send at a time. That way you would never need more then 1 uart on any processor and you could have many processors.

I said that I did not think you were up to it becasue you are still learning about RS232. When is your project due ?
 
is polling the keybad would work! i think if it is wid interrupt would be better, like the pc keyboard!!
 
Eng.Remon said:
is polling the keybad would work! i think if it is wid interrupt would be better, like the pc keyboard!!

I've no idea if a PC keyboard is polled or uses interrupts?, I would imagine it might be polled? - the processor isn't doing anything else. This is the processor in the keyboard itself!, the PS2 connection to the PC may well use an interrupt?, but if it's a USB keyboard it definately doesn't! - USB doesn't have interrupt capability.
 
ummm but it is 4*4 keybad also this uc is making output of the lcd and also monitor other uc so beter for it to be on int. isnt it?
 
Eng.Remon said:
ummm but it is 4*4 keybad also this uc is making output of the lcd and also monitor other uc so beter for it to be on int. isnt it?

Doesn't make much difference really?, the LCD is of no concern, it's only an output, and is only driven occasionally, if you're using a hardware UART you've got plenty of time to check that, and even with a software UART it's not a problem, you've still got more than enough time, and just check the keypad periodically.

If you go back to VERY old PIC's, only 12 bit, and no interrupt capability, there's an application note at MicroChip that shows how to make a digital clock using one. It multiplexes 7 segment LED's for the display, scans the keyboard (note that both the display and keyboard share I/O pins as well!), and keeps accurate time running. All this with polling, not an interrupt in sight! (or possible).

Interrupts certainly have their uses, and often are essential, but no where near as often as you might think.

Do you have fully working interrupt driven keypad routines?, if you do there's no point in changing them!.
 
i m not using pic i m using atmel 80c51, also i dont know any info about it :S,
what do u mean about the interrupt!?
Do you have fully working interrupt driven keypad routines?, if you do there's no point in changing them!.
 
Eng.Remon said:
i m not using pic i m using atmel 80c51, also i dont know any info about it :S,

I know, I was only using the old PIC example to show what you can do without interrupts.

what do u mean about the interrupt!?

Do you have fully working interrupt driven keypad routines?, if you do there's no point in changing them!.

I mean have you got that part all written and working?.
 
ummm ok i did all the part of sensors with uc1.
i did the keybad with int and lcd with uc2
i m on my way to finish the dtmf generator and receiver with hang up on the uc3 . what i didnt do is connected and make the protocols between each. thats what i have problems in .
so in other meaning i did each one seperatly . but not connected with whole the project
 
Eng.Remon said:
ummm ok i did all the part of sensors with uc1.
i did the keybad with int and lcd with uc2
i m on my way to finish the dtmf generator and receiver with hang up on the uc3 . what i didnt do is connected and make the protocols between each. thats what i have problems in .
so in other meaning i did each one seperatly . but not connected with whole the project

Is it safe to say that the goal is to finish the project as quick as possible and still have it look good to the person who grades it.

Go with RS232 because it will handle the distance you require and it is most easily understood.

U2 is the difficult part because it needs to UARTS. The link between it and U1 gets the most traffic so use the hardware UART for that. The link between U2 and U3 is used only when a phone call is to be made. Since no one will be calling in U3 should never have to start a conversation with U2. Should be safe to used a software (bit bang) Uart for this link.

U1 and U3 only require one UART which they have.

Read up on the 80c51 UART and see if you can find and drivers online or in app notes that you can use. Do the U2-U1 connection first because it uses only hardware UARTS. You can go polled or with interrupts whatever you can find.

Next find a bit-bang routine for the 80c51. Go with polled here. You only have to pay attention to U3 if you are expecting a responce from it.

Now write your protocol.
You have been taling about encoding the data between U2-U1 in eight bits. You can do that, but since the traffic is light you could use a human readable one.

For example if U1 wanted to tell U2 the temerature was 23
From U1 to U2:
T23
From U2 to U1:
AT23

When U1 sees the msg sent back with an A prepended it knows that U2 has the message. Keep it simple. I would not get much more complicated then this as it is not needed.

The above suggestion uses about 10 times the bytes to send but it is closed loop and you can read it without decoding a binary mapping. There is overhead in converting numbers to and from ASCII strings.
 
ok first i ll read about RS232 , but can u tell me what is bit-bang routine!?
 
Eng.Remon said:
ok first i ll read about RS232 , but can u tell me what is bit-bang routine!?

'Bit-banging' is a software UART - although you're not using a PIC, you might try reading my PIC RS232 tutorial, which explains it.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top