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.
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**
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.
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.
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..
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....