zoukankan      html  css  js  c++  java
  • *** error 65: access violation at C:0x001B : no 'execute/read' permission

    转自:http://blog.csdn.net/chenqiai0/article/details/7827071

    很多人在进行串口调试的时候会遇到这个问题,请大家略看我的代码,解决方法在其中

    //实验目的:串口调试助手上输入数据0-9,然后再数码管显示
    org 00H
    ljmp start

    org 23H //中断入口地址
    ljmp uart_interrupt 

    org 30H
    start:   
            
        mov P0,#0xff//设置初始值
        mov dptr,#numb
        lcall en
        lcall UART_init 
           here: sjmp here  //好比是一个while(1)循环


    ;首先3/8译码器使能 并且选中第一个数码管用于显示
    en:
        clr   P1.4
     setb  P1.3
     clr   P1.0
     clr   P1.1
     clr   P1.2
    ret

    //uart初始化
    UART_init:

       mov TMOD,#0x20  //0010 0000   说明在定时器1的工作方式2下工作
       mov  TH1,#0xFD
       mov  TL1,#0xFD 
       setb TR1  //定时器1运行控制位=1,说明开始计时
       mov SCON,#0x50 //0101 0000   前两位说明在串口工作方式1  第三位SM2在方式1设置为0  第四位REN=1允许串口接收
       setb EA
       setb ES
       //setb ET1    //错误:*** error 65: access violation at C:0x001B : no 'execute/read' permission
                     //解决办法:timer1是做为串行通信的波特率发生器,设置为方式2(自动填充)为ET1被置位,而timer1没有跳转函数(因为是自动填充)
                    //所以timer1 会执行中断,跳转到中断入口0x1B,使程序跑飞了。不置位ET1就可以了
     ret

    //中断服务程序
    uart_interrupt:

       send:
         mov A,#0x02
      anl A,SCON 
         cjne A,#2, receive
      clr TI
      setb REN
       
       receive:
         mov A,#0x01
      anl A,SCON 
         cjne A,#1,quit
      clr RI 
      mov R4,SBUF
      mov R3,SBUF
      mov A,R4
      subb A,#0x30
      movc A,@A+dptr
      mov P0,A
      addc A,#0x30
      mov SBUF,R3
      clr REN
       quit:
      reti
                
    //0-9

    numb:
         DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
    end  


     大家注意看ET1=1这一段,注释就是解决方法

     
     
  • 相关阅读:
    火车进出栈问题(卡特兰数)
    HDU 4699 Editor (对顶栈)
    HDU 6430 TeaTree (线段树合并)
    Exam 4895 Crowd Control
    Exam 4894 Booming Business
    8377: Playoff
    hdu 6345 Problem J. CSGO
    HDU 6437 Problem L.Videos
    Making the Grade
    poj2279——Mr. Young's Picture Permutations
  • 原文地址:https://www.cnblogs.com/shirishiqi/p/5407838.html
Copyright © 2011-2022 走看看