electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

PC to Microcontroller Interfacing


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> PC to Microcontroller Interfacing
Author Message
maxsteel3000



Joined: 29 Nov 2007
Posts: 5
Helped: 1


Post08 Sep 2009 8:38   

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.

QuestionQuestionQuestionQuestionQuestionQuestionQuestion
Back to top
Google
AdSense
Google Adsense




Post08 Sep 2009 8:38   

Ads




Back to top
seadolphine2000



Joined: 12 Apr 2005
Posts: 621
Helped: 39


Post08 Sep 2009 11:19   

microcontroller interfacing projects


I'm not a "C-Language" professional, but I made a small program in "Visual Basic" where I had full control over my PIC. I can send whatsoever data I want as well as receiving data from the PIC.
So, I you like, I can share my ideas with you. But again, it will be in VB.
Back to top
maxsteel3000



Joined: 29 Nov 2007
Posts: 5
Helped: 1


Post08 Sep 2009 11:42   

microcontroller personal computer


Sure

it will be helpful . . .
Back to top
seadolphine2000



Joined: 12 Apr 2005
Posts: 621
Helped: 39


Post08 Sep 2009 12:48   

Re: PC to Microcontroller Interfacing


OK,
You can start using the Hyper Terminal of the windows to send a characters using the COM port. Connect the microcontroller to the PC using the below schematic

http://www.coolcircuit.com/circuit/rs232_driver/max232.gif

Now, you can write your microcontroller firmware that will listen to the COM port and, decode the characters sent by the Hyper Terminal. Thus, you can control the ports of the microcontroller.

This is the idea using the Hyper Terminal or a VB program. I don't know how you are going to implement such thing in C/C++.

I hope this helps.
Back to top
maxsteel3000



Joined: 29 Nov 2007
Posts: 5
Helped: 1


Post08 Sep 2009 18:42   

Re: PC to Microcontroller Interfacing


I want some control over my pc that is to be triggered using the uC.

for example

if pin1 of port a is high then that would indicate the pc to use the defined shortcut clrt+e(say)

in short i want my uC to use my computer not vice-verse
Back to top
Kurenai_ryu



Joined: 10 Jun 2006
Posts: 179
Helped: 22
Location: Bolivia


Post08 Sep 2009 23:31   

PC to Microcontroller Interfacing


mmmm... if you are using RS232 serial TX/RX you will need a program in the PC to get the data, and generate events... (like opening programs... closing... filling text.. etc)
if you don't want to make a program like that... you should consider emulate a PC keyboard... so.. when you change a pin in the microcontroller it will send a series of keystrokes to the PC right to get your desired behavior...

this can be made emulating the PS/2 interface, or implementing an USB HID keyboard...

it's up to you wich one is better for your project...


(sorry my bad english...)
Back to top
Somphorn



Joined: 04 Sep 2009
Posts: 37
Helped: 1
Location: Johore, Malaysia


Post10 Sep 2009 12:10   

PC to Microcontroller Interfacing


I think I can imagine what you're trying to do here. I don't know much about microcontroller, but maybe you can do the following:

I think the easiest way is via parallel port. You must find out which pin can receive TTL input. Supply logic HI to the pin, observe the value at x0378 (or 0x379, or whatever. I don't know exactly).

For this you may want to create a simple program to loop forever and read the value at the input port while doing so. Play around with the supply voltage at the input pin. Note down what is the value when there is no supply (logic LO) and the value when there is logic HI. Remember those numbers.

Now, if under real DOS mode and no other programs running, with your target program running and continuously monitoring the value at the input port you can let the program do whatever you want once it detect the value for logic HI.

Now, that's just for one input pin. Once you get the hang of this then maybe you want to expand the idea to handle more input pins, where the values are to be read at the same input port.

Actually each input pin of the parallel port will either set or reset individual bits that make up the whole input port value. ( <-- do you understand this sentence?! )

I don't know much if it involves Windows environment, and other than parallel port.
Back to top
arbj



Joined: 05 Oct 2008
Posts: 47
Helped: 6


Post11 Sep 2009 8:13   

PC to Microcontroller Interfacing


use a standard protocol like XMODEM over a RS232 line. This may be the easiest way..
Back to top
elrayes



Joined: 03 Jun 2008
Posts: 164
Helped: 8
Location: Egypt


Post11 Sep 2009 13:01   

PC to Microcontroller Interfacing


you can use PIC18F4550 to implement USB interface, don't panic from USB cause USB firmware is ready made and free for download from microchip website under the name "Microchip USB framework", you will find it firmware to make PIC18F4550 act like HID, CDC, OTG, Host and many other projects included.
in my opinion use the CDC firmware cause it will make your PIC appear as virtual COM through USB which mean you easily interface through hyperterminal. C++ or VB.
remember when you install "Microchip USB framework" to choose projects used for "PICDEM FSUSB" board, cause the firmware was for this board which is based on PC18F4550 mcu.
good luck
Back to top
maxsteel3000



Joined: 29 Nov 2007
Posts: 5
Helped: 1


Post12 Sep 2009 22:53   

Re: PC to Microcontroller Interfacing


Thats really a nice and easy idea to try

thanks
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> PC to Microcontroller Interfacing
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Interfacing keyboard to microcontroller (13)
USB microcontroller interfacing (3)
interfacing a webcam to microcontroller (1)
PIC microcontroller interfacing (5)
Interfacing W5100 to microcontroller (2)
INTERFACING PENDRIVE TO MICROCONTROLLER (5)
voice codec interfacing to microcontroller (2)
interfacing into ADC of microcontroller (8)
PCMCIA interfacing with microcontroller (1)
Interfacing NIC with microcontroller (3)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS