Thread: troubleshooting on parallel port

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    22

    troubleshooting on parallel port

    Hi all
    I am trying to make security system.
    I same thing that all have seen the movies that some important thing is secured by the laser beam and when one try to penetrate to laser beam than alarm blow up.
    My concept is to use the LDR (photoresistor) and laser (which is focusing on the LDR).
    I want to make it with my system's parellel port {LPT1}.So what i was thinking that untill laser is pointing to LDR is sends 1 and when laser intrupted occur it become 0.

    Code:
    So my que is that at what voltage does parallel port undersand 0 and 1.
    I have experimented by conecting one end of LDR data pin D0 (pin 2) and for voltage i have use 4.5v battery and make it ground to pin 25.I have used lamp instead of laser but the inportb(0x378) gives 0 both time(with light and without light).
    why this happned?

  2. #2
    No idea. But some thoughts anyways since this is interesting: Try connecting a good voltometer your port and then write data to the port. See what happens. Whatever comes out will be what's supposed to go in.

    I assume you have the code set up correctly to monitor the port? Have you tested it by sucessfully writting data into it from another computer?
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  3. #3
    www.entropysink.com
    Join Date
    Feb 2002
    Posts
    603
    Visit entropysink.com - It's what your PC is made for!

  4. #4
    www.entropysink.com
    Join Date
    Feb 2002
    Posts
    603
    >>I have experimented by conecting one end of LDR data pin D0 (pin 2) and for voltage i have use 4.5v battery and make it ground to pin 25.

    Can you post a diagram of how you wired this??
    Visit entropysink.com - It's what your PC is made for!

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    22
    just leave it
    I have replyed this to inform you that I finally done what i was tryin to do.
    My circuit is the simplest one ever.It is like
    pin15=>LDR=>pin25
    As i was thinking that data pins should be bi-directional but i was wrong.
    I have used Pin 15 which is status pin (S3)
    on my system when i read status pin registor[inportb(0x379)] without light,it gives 127 which means all pins are set to 1 except the S7 because it is inverted.
    So i use same pin (pin15) for reading the input and for power supply as well.
    In presence of light i get 119 which means S3 and S7=0 and all other pins set to 1.It means S3 got changed BINGO! thats what i want.
    Thnaks for replying

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parallel Port IO ops not working properly
    By microtechno in forum Linux Programming
    Replies: 16
    Last Post: 06-08-2009, 12:33 PM
  2. Parallel Port to USB controller and outb()
    By coletek in forum Linux Programming
    Replies: 1
    Last Post: 06-05-2009, 06:57 AM
  3. Replies: 3
    Last Post: 02-29-2008, 01:29 PM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. Segmentation Fault - Trying to access parallel port
    By tvsinesperanto in forum C Programming
    Replies: 3
    Last Post: 05-24-2006, 03:28 AM