Author Topic: Status Port  (Read 5728 times)

lutando

  • Member
  • ***
  • Posts: 4
Status Port
« on: October 09, 2012, 11:59:58 am »
I'm stuck in the reading the status pin in the parallel port, I can write to the data pins and they working fine,but when I read the status port it keeps returning value 119,and when I check using the multimeter the value should change,as I measure to the point it enters the PC, I'm 100 percent sure its not the circuit or the cable, do you know what might be the problem

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2804
    • Lakeview Research
Re: Status Port
« Reply #1 on: October 09, 2012, 12:53:55 pm »
So, for example, when you bring pin 15 (status port bit 3) logic high and verify that's high with a voltmeter, you still read 119 (77h) at the port's base address + 1?



lutando

  • Member
  • ***
  • Posts: 4
Re: Status Port
« Reply #2 on: October 10, 2012, 06:19:00 am »
I have switches connected to pin 10,11,13, the circuit from the pin to an input of a buffer(74LS244) to output to a switch with a pull up transistor, so i read the whole byte(&H379) when nothing is pressed, i get 119, and i press the switches, the voltages change but the value i read, remains the same...i have nothing connected to the pin 15, is this where the problem lies?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2804
    • Lakeview Research
Re: Status Port
« Reply #3 on: October 10, 2012, 10:19:46 am »
Pin 15 was just an example. Your description sounds correct.

What is the code that reads the status port?

lutando

  • Member
  • ***
  • Posts: 4
Re: Status Port
« Reply #4 on: October 11, 2012, 02:08:59 am »
Option Strict Off
Option Explicit On

Module InpOut32_Declarations

    Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer

    Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal PortAddress As Integer)

End Module
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
         Dim value1 As String
        value1 = Inp(&H379)
        TextBox1.Text = value1

       

    End Sub

I dont realy want to blame the code, as writing to the data pins works perfectly, but heres the code

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2804
    • Lakeview Research
Re: Status Port
« Reply #5 on: October 11, 2012, 10:32:54 am »
I don't see anything you're doing wrong.

As a sort of sanity check, try writing 1 to control port bit 5 and then see if you can read voltages at the data port:

x = control port read
control port write = x OR 20h
y = data port read

lutando

  • Member
  • ***
  • Posts: 4
Re: Status Port
« Reply #6 on: October 12, 2012, 02:53:36 am »
Ok i will try that, also one of my friends told me to connect my switches straight to ground, and not connect them to a 5v voltage, so take straight from status,through my 74LS244 to switch to ground, i havent done it yet, i hope it works because im using my data pins as output,dont realy want to fiddle with them,anyways thanks for the input,im a student in south africa and i have your book,without it i wuldnt be this far with my project.