Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic 16f876 programing problem

Status
Not open for further replies.

rajat54

New Member
dear sir

i hav been trying to make a simple circuit which uses a pic 16f876 and a printer port to communicate .. i have made the hex file and also put it in the ic but can u plz tell me that how can i read the data from printer port in to the chip to perform a simple addition .. also plz tell me that what happens when the pic is powered on.. does the hex file added into it executes auotmatically and if not how can i execute it. :?:
i have been tryin to send data to the printer port using c++ program ..so how can i synchronize it wih my requirement of the data read by the ic.
is there any circuit diagram available for makin a circuit to connect the pic to the printer port plz help i am in urgent need of this information
 
A PIC performs a reset when it powers up, and starts running code from it's 'reset vector', for the 16F876 this is address 0x0000.

Perhaps you had better explain more about what are trying to do, it's unusual to use the parallel port to connect to a PIC - much easier to use the serial port.
 
1) Which windows version are you using?

2) Did you connect right pins to send and receive data from pc ?

3) Connect ltp to a port of pic, you can send and receive via that port. But at each time, you have to change TRIS port.

4) You should have a shift register to wait until Pic read the data. Or you may use a control pin to make interrupt on pIC and let it receive the data.

5) To recieve data, you have to use bidirectional port or you can use upto 9 inputs of LTP.
 
THANK YOU SO MUCH FOR REPLYING
ACTUALLY I AM USING A WIN XP OPERATING SYSTEM IN WHICH I TRYING TO MAKE A HARDWARE SECURITY LOCK KIND OF A THING.. AS IN A PARTICULAR EXE FILE EXECUTES ONLY WHEN THIS HARDWARE(PIC 16F876 CIRCIUT) IS PRESENT AT THE PARALLEL PORT.. THE IDEA IS TO JUST READ A PARTICULAR VALUE FROM THE PORT WHICH IS SECRET AND ONLY IF THE VALUE IS CORRECT THE SOFTWARE GIVES FURTHER ACESS TO THE USER.. SO WHAT DO YOU SUGGEST THAT SHOULD I USE A USB PORT FOR IT.. IN THAT CASE WILL I NEED A DRIVER ALSO..AND ALSO HOW CAN I GET THE PIN DIAGRAM AND ALL FOR THA USB PORT

What i initially intended to do was to send the hex file to the lpt port so that it can parallely be read on port A whose pins i would connect to the lpt port's data pins. However, somebody told me the hex file would be written using JDM in the PIC itself. Please suggest what is a better way? Starting altogether with the USB port would be a bit tedious for me now.

Also does XP not allow sending data to the lpt port using a C code the way windows 98 does?? if so, what is the alternative??
 
1st off all, like already said, it will be much easyer to use the serial port.
it requires less connections (only 2), the pic you use (overkill in my opinion) has an hardware serial port onboard and serial port programming is supported by the windows api. Programming the parallel port is a real pain in windows XP because it is not supported in the API and windows XP forbids you to directly bit-bang it.

Also, once you get this project running, i would suggest switching to a smaller pic, a cheap 8 pin pic can do this, at 1/10 the cost and size.
even a 12c508 would be fine.
 
THANK YOU SO MUCH FOR REPLYING
ACTUALLY I AM USING A WIN XP OPERATING SYSTEM IN WHICH I TRYING TO MAKE A HARDWARE SECURITY LOCK KIND OF A THING.. AS IN A PARTICULAR EXE FILE EXECUTES ONLY WHEN THIS HARDWARE(PIC 16F876 CIRCIUT) IS PRESENT AT THE PARALLEL PORT.. THE IDEA IS TO JUST READ A PARTICULAR VALUE FROM THE PORT WHICH IS SECRET AND ONLY IF THE VALUE IS CORRECT THE SOFTWARE GIVES FURTHER ACESS TO THE USER..

Yes we can open the port with io*.dll which can be download at www.lvr.com
After that, you should restart your PC on Dos, and rename the "dllcache" hiden folder on system32 to "backup_dll". And you can control the parallel with ease, like in win98.

SO WHAT DO YOU SUGGEST THAT SHOULD I USE A USB PORT FOR IT.. IN THAT CASE WILL I NEED A DRIVER ALSO..AND ALSO HOW CAN I GET THE PIN DIAGRAM AND ALL FOR THA USB PORT

I think you don't need to use usb, because it's so expensive to build usb communication. You need a usb driver of which price may upto 50USD. and the cheapest one I saw is 25USD.

Exo said right, why dont you use serial port? You use a laptop and it doesn't support COM port?

Also does XP not allow sending data to the lpt port using a C code the way windows 98 does?? if so, what is the alternative??


Yes, I use io*.dll (i don't remember the name) and I can write it in Visual C++ .NET. So i'm sure it works with C.


What i initially intended to do was to send the hex file to the lpt port so that it can parallely be read on port A whose pins i would connect to the lpt port's data pins. However, somebody told me the hex file would be written using JDM in the PIC itself. Please suggest what is a better way? Starting altogether with the USB port would be a bit tedious for me now.

hex number is not a problem. It's only the way to view. The real number alway known by PC is binary number. In the program, you can use both hex number or decimal or binary number if you want.

You shouldn't connect directly the parallel to port A, even it may works because the output will be kept at the output pins of parallel. But I suggest to use a shift register and you can use handshake method to read and write. However, using this method, you will lost pin1 nStrobe, and nAck to control the transmission. Therefore, you only have 8 inputs remains for the parallel (but i guess it's enough for your application).
 
Status
Not open for further replies.

Latest threads

Back
Top