Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

inputs to a microcontroller

Status
Not open for further replies.

jayanthyk192

Full Member level 3
Joined
Sep 17, 2010
Messages
179
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
2,580
Hi,

i'm using a P89V51RD2 MC for my project.i wanted to take inputs to the microcontroller through 3 pins.is there any command or function like scanf that waits until i give an input?

also,i wanted to know if i could store these inputs on the memory of the MC.
 

If you are not using any external interrupts or interrupt mechanism then you have to scan the three pins and wait until the input comes

you can store those values in the memory (IRAM/XRAM)
 
The best way to monitor inputs is to use interrupt(s) ..
8051 can handle only two external interrupts and if you want to sense more inputs you have to implement a trick that allows to extend the number of monitored pins – in this case - to 4 ..
See:
**broken link removed**

IanP
:wink:
 

Attachments

  • 8051 - 4 x ext-int.gif
    8051 - 4 x ext-int.gif
    17.1 KB · Views: 75

thank you all for the help.

the interrupt programming is good but i have 2 problems regarding the use of it.

>i want more input lines to get feedback from some sensors i'm using,

>i don't have any knowledge on interrupt service programming.i googled a few pages,but all the interrupt service programs were in assembly(i can do things only in 'C')

so i want to learn to take multiple inputs at the same time.i would also like to program interrupt in C,where can i get resources?(only C please).

i also want to know how to store the inputs to the MC in its memory.
 
Last edited:

i found the use of "bit" in one of the programs.the program had the following lines

void main(void) // main function begins
{
bit SwitchState; //Declare a bit "SwitchState" to store the value of switch


so i thought of using 8 such variables to store and use the inputs.i would eventually be requiring 11 inputs,so is there any other method by which i can inputs?(this method seems very clumsy.)
 

good evening to all.I am using 89c51 micro controller to use a external interrupt.now i want to count the external interrupts how can i do.anybody help me please and send the code.

thank in advance.
 

use a variable with datatype as volatile.. write ISR to count the input at the counter pin at rising edge or low level and exit after counting every pulse..

refer mazidi or 8052.com - The Online 8051/8052 Microcontroller Resource - 8052.com for more information

---------- Post added at 19:35 ---------- Previous post was at 19:32 ----------

i found the use of "bit" in one of the programs.the program had the following lines

void main(void) // main function begins
{
bit SwitchState; //Declare a bit "SwitchState" to store the value of switch


so i thought of using 8 such variables to store and use the inputs.i would eventually be requiring 11 inputs,so is there any other method by which i can inputs?(this method seems very clumsy.)

if you need 11 inputs the you can you 1 full port with 8 bits and 3 extra port pins and use it.... 3 pins you can use a sbit and other treat it as 1 full port....
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top