搜索
bottom↓
回复: 6

请问有没有PC机并口测试的软件?

[复制链接]

出0入0汤圆

发表于 2010-1-29 16:59:49 | 显示全部楼层 |阅读模式
因为本人的PC机并口没有引出插槽,故在网上买了个并口转接线挡板。

现在并口ISP编程不成功,用友善之臂的H-JTAG也有问题,只是能够识别到时ARM920T内核而已。

怀疑是转接线连接不正确,故想找个软件测试一下。
就是通过设置某个针脚的电平,再用万用表逐一测试排除。

请问有没有类似的软件?或者哪个大侠能够帮忙写一个?谢谢!

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2010-1-29 17:25:56 | 显示全部楼层
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <stdlib.h>
#include "pci.h"
#define BASE 0x378
#define DATA BASE+0x00
#define STATUS BASE+0x01
#define CONTROL BASE+0x02
#define ECR  BASE+0X402
#define IRQ 7
#define PIC1 0x20
#define PIC2 0xA0

#ifdef __cplusplus
    #define __CPPARGS ...
#else
    #define __CPPARGS
#endif

int interflag; /* Interrupt Flag */
int picaddr;   /* Programmable Interrupt Controller (PIC) Base Address */
void interrupt (*oldhandler)(__CPPARGS);

void interrupt parisr(__CPPARGS)  /* Interrupt Service Routine (ISR) */
{
  interflag = 1;
  outportb(picaddr,0x20); /* End of Interrupt (EOI) */
}

int main()
{
    unsigned int init_con_status,init_ECR,Before_Status,Current_Status;
    unsigned char Bus,Dev,Fun;
    unsigned long int Data;
    int passflag;
    int intno;    /* Interrupt Vector Number */
    int picmask;  /* PIC's Mask */

    passflag=0;
    clrscr();
    printf("                             Build Date:2010-01-14\n");
    printf("                 Prnloop utility for SEGA02 developed by Advantech AKMU MTD\n");
    printf("===============================================================================\n");
    //enable parallel function in south bridge
    Bus = 0;
    Dev = 31;
    Fun = 0;
    Data=Read_PCI_REG(Bus, Dev, Fun, 0x80);
    Write_PCI_REG(Bus,Dev,Fun,0x80,Data|0x00040000); //Enable Parallel Port,LPT_LPT_EN

    init_con_status=inportb(CONTROL);
    init_ECR=inportb(ECR);

    //check Pin 1 and 2-9,10
    //check high->low
    outportb(ECR,inportb(ECR)|0x30); //select PS/2 mode
    outportb(CONTROL,inportb(CONTROL)|0x21);
    if (inportb(DATA)==0x00)
        printf("Data signal data 0-7 high->low pass\n");
    else
    {
        printf("Data signal data 0-7 high->low fail\n");
        passflag=1;
    }

    if (((inportb(STATUS)&0x40)/0x40)==0)
        printf("Status signal nACK high->low pass\n");
    else
    {
        printf("Status signal nACK high->low fail\n");
        passflag=1;
    }

    outportb(CONTROL,init_con_status|0x20);
    if (inportb(DATA)==0xFF)
        printf("Data signal data 0-7 low->high pass\n");
    else
    {
        printf("Data signal data 0-7 low->high fail\n");
        passflag=1;
    }

    if (((inportb(STATUS)&0x40)/0x40)==1)
        printf("Status signal nACK low->high pass\n");
    else
    {
        printf("Status signal nACK low->high fail\n");
        passflag=1;
    }

    //check Pin 16&pin11
    //check high->low
    Before_Status=inportb(STATUS);
    outportb(CONTROL,init_con_status&0xFB);
    Current_Status=inportb(STATUS);
    #ifdef DEBUG
    printf("Before status port value=%2X,Current status port value=%2X",Before_Status,Current_Status);
    #endif
    if ((Before_Status^(Current_Status))==0x80)
        printf("Control signal nINIT and status signal BUSY high->low pass\n");
    else
    {
        printf("Control signal nINIT and status signal BUSY high->low fail\n");
        passflag=1;
    }

    //check low->high
    Before_Status=inportb(STATUS);
    outportb(CONTROL,init_con_status|0x04);
    Current_Status=inportb(STATUS);
    #ifdef DEBUG
    printf("Before status port value=%2X,Current status port value=%2X",Before_Status,Current_Status);
    #endif
    if ((Before_Status^(Current_Status))==0x80)
        printf("Control signal nINIT and status signal BUSY low->high pass\n");
    else
    {
        printf("Control signal nINIT and status signal BUSY low->high fail\n");
        passflag=1;
    }
    //IRQ TEST
    /* Calculate Interrupt Vector, PIC Addr & Mask. */

    if (IRQ >= 2 && IRQ <=7 ) {
                              intno = IRQ + 0x08;
                              picaddr = PIC1;
                              picmask = 1;
                              picmask = picmask << IRQ;
                              }
    if (IRQ >= 8 && IRQ <= 15) {
                               intno = IRQ + 0x68;
                               picaddr = PIC2;
                               picmask = 1;
                               picmask = picmask << (IRQ-8);
                               }
    if (IRQ < 2 || IRQ > 15)
    {
          printf("IRQ Out of Range\n");
          exit(1);
    }
    outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Make sure port is in Forward Direction */
    outportb(DATA,0xFF);
    oldhandler = getvect(intno);  /* Save Old Interrupt Vector */
    setvect(intno, parisr);      /* Set New Interrupt Vector Entry */
    outportb(picaddr+1,inportb(picaddr+1) & (0xFF - picmask)); /* Un-Mask Pic */
    outportb(CONTROL, inportb(CONTROL) | 0x10); /* Enable Parallel Port IRQ's */
    printf("Parallel Port Interrupt Polarity Tester\n");
    printf("IRQ %d : INTNO %02X : PIC Addr 0x%X : Mask 0x%02X\n",IRQ,intno,picaddr,picmask);
    interflag = 0; /* Reset Interrupt Flag */
    delay(10);
    outportb(DATA,0x00); /* High to Low Transition */
    delay(10);           /* Wait */
    if (interflag == 1) printf("Interrupts Occur on High to Low Transition of ACK.\n");
    else
      {
       outportb(DATA,0xFF); /* Low to High Transition */
       delay(10);           /* wait */
       if (interflag == 1) printf("Interrupts Occur on Low to High Transition of ACK.\n");
       else
       {
        printf("No Interrupt Activity Occurred. \nCheck IRQ Number, Port Address and Wiring.");
        passflag=1;
       }
      }
    outportb(CONTROL, inportb(CONTROL) & 0xEF); /* Disable Parallel Port IRQ's */
    outportb(picaddr+1,inportb(picaddr+1) | picmask); /* Mask Pic */
    setvect(intno, oldhandler); /* Restore old Interrupt Vector Before Exit */
    //end of IRQ Test
    outportb(CONTROL,init_con_status);
    outportb(ECR,init_ECR);
    gotoxy(35,19);
    if (passflag==0)
    {
        textcolor(GREEN);
        cprintf("       PASS\n");
    }
    else
    {
        textcolor(RED);
        cprintf("       FAIL\n");
    }
    gotoxy(35,20);
    cprintf("Return Code is %d",passflag);
    return passflag;
}

出0入0汤圆

发表于 2010-1-29 17:26:44 | 显示全部楼层
这个得要根据你的SUPER IO 型号来改一下就好了!

出0入0汤圆

 楼主| 发表于 2010-1-29 17:54:13 | 显示全部楼层
编译器?移植好有难度啊……我想找个有图形界面的……

出0入0汤圆

发表于 2010-1-29 18:03:44 | 显示全部楼层
并口开发调试工具包 V2.0

出0入0汤圆

发表于 2010-1-29 18:32:25 | 显示全部楼层
easy 51pro里面也有个并口测试工具,很小很小

出0入0汤圆

 楼主| 发表于 2010-2-1 12:24:54 | 显示全部楼层
谢谢楼上三位
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-20 12:52

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表