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.

PC to Microcontroller Interfacing

Status
Not open for further replies.

maxsteel3000

Newbie level 4
Newbie level 4
Joined
Nov 29, 2007
Messages
5
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,317
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.

:?::?::?::?::?::?::?:
 

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.
 
microcontroller personal computer

Sure

it will be helpful . . .
 

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

https://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.
 
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
 

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...)
 
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.
 
use a standard protocol like XMODEM over a RS232 line. This may be the easiest way..
 
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
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top