maxsteel3000
Newbie level 4
interfacing pc with microcontroller
I have been working on a project to reverse interfacing. i mean that its easy to make a uC do a certain job like lighting up all the LEDs connected to portA.
SAMPLE PROGRAM:
If we want to write program in which, when button ‘a’ on keyboard is pressed then all the LED connected to PORTA should be ON , when button ‘s’ is pressed all LED should be OFF.
#include <mega32.h>
#include <stdio.h> // Standard Input/Output functions
Void main()
{
DDRA=0xFF;
PORTA=0×00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 9600
UCSRA=0×00;
UCSRB=0×18;
UCSRC=0×86;
UBRRH=0×00;
UBRRL=0×33;
while (1)
{
if (getchar() == ‘a’)
{
PORTA=0×11111111;
}
if (getchar() == ‘b’)
{
PORTA=0×00;
}
};
}
But if PIN 1 of PORT A is high (suppose) the pc opens a text editor and displays A1
can this be done????
if yes then please explain me the steps required.
:?::?::?::?::?::?::?:
I have been working on a project to reverse interfacing. i mean that its easy to make a uC do a certain job like lighting up all the LEDs connected to portA.
SAMPLE PROGRAM:
If we want to write program in which, when button ‘a’ on keyboard is pressed then all the LED connected to PORTA should be ON , when button ‘s’ is pressed all LED should be OFF.
#include <mega32.h>
#include <stdio.h> // Standard Input/Output functions
Void main()
{
DDRA=0xFF;
PORTA=0×00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 9600
UCSRA=0×00;
UCSRB=0×18;
UCSRC=0×86;
UBRRH=0×00;
UBRRL=0×33;
while (1)
{
if (getchar() == ‘a’)
{
PORTA=0×11111111;
}
if (getchar() == ‘b’)
{
PORTA=0×00;
}
};
}
But if PIN 1 of PORT A is high (suppose) the pc opens a text editor and displays A1
can this be done????
if yes then please explain me the steps required.
:?::?::?::?::?::?::?: