导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→关于U2270的问题!!!请高手请教!![ljwmf]

 *第18664篇: 关于U2270的问题!!!请高手请教!!

  
楼 主:ljwmf 2004年1月14日22:19
 关于U2270的问题!!!请高手请教!!
我用U2270和89C52做了一个读ID卡的读卡器。用仿真器仿真时,先复位再运行,能立刻读出卡号。但运行一段时间后,再读卡号时要很久才读出卡号。请问是U2270模块的问题
还是单片机模块的问题呢?程序是绝对没问题的,因为用同样的程序在另外一块板(另外一块板不是我设计的)上就读卡很顺利。
  
2楼:guest 2004年8月3日17:20
 [原创]
没有的事,我用开发很长时间,没有问题.你能把程序和电路图给我发在ZFJLRX@163.COM中我帮你看一下.
  
3楼:guest 2004年11月11日21:15
 A
A
  
4楼:guest 2004年11月11日21:24
 [求助]检测E5550卡的同步信号是否正确?在线等待啊!
;
;1、本程序在检测同步信号的写法是否正确???
;2、运行环境:11.0592MHz、U2270B、AT59C52、E5550卡

t_DalayPara_3 DATA 2DH ;Used only by f_delay.
t_DalayPara_2 DATA 2EH ;Used only by f_delay.
t_DalayPara_1 DATA 2FH ;Used only by f_delay.

t_OutputCount DATA 25H ;Used only by f_OutputA

t_Data1HighByte DATA 24H ;Used only by f_Compare16Bit.
t_Data1LowByte DATA 23H ;Used only by f_Compare16Bit.
t_Data2HighByte DATA 22H ;Used only by f_Compare16Bit.
t_Data2LowByte DATA 21H ;Used only by f_Compare16Bit.
i_CompareFlag   BIT 01H ;Used only by f_Compare16Bit. It is situated at 
       ;20H byte in bit access area.

i_CurrentLevel  BIT 00H ;Saves current level of OutPut pin of U2270B.

p_U2270B_CFE BIT p1.2
p_U2270B_OutPut BIT p1.3
p_75LBC184_REDE BIT p1.4 ;The pin RE and DE of 75LBC184 connect.
p_X5045P_SCK BIT p2.4
p_X5045P_SI BIT p2.3
p_X5045P_WP BIT p2.2
p_X5045P_CS BIT p2.0
p_X5045P_SO BIT p2.1
p_LED_GreenBig BIT p1.0 ;The green led and the big led connect.
p_LED_RED BIT p1.1
p_PNP_B  BIT p1.7 ;Voice cue when it equal 0,vanishes when 1.

  MOV TMOD,#10001B  ;T0 和 T1 都为模式1,16位。
  LCALL f_ReadCard  ;读取IC卡数据
;----------------------------------------------------------------------------
;子程序功能 : 比较两个16位数据的大小。
;t_Data1HighByte: 第一个数据的高8位。
;t_Data1LowByte : 第一个数据的低8位。
;t_Data2HighByte: 第二个数据的高8位。
;t_Data2LowByte : 第二个数据的低8位。
;i_CompareFlag : 如果 i_CompareFlag = 0,那么第一个数据大于或等于第二个数据。
;                 如果 i_CompareFlag = 1,那么第一个数据小于第二个数据。
f_Compare16Bit: MOV A,t_Data1HighByte
  CLR C
  SUBB A,t_Data2HighByte ;A - t_Data2HighByte - C
  JC l_Data1_isSmall

  ;This time, t_Data1HighByte >  = t_Data2HighByte.
  MOV A,t_Data2HighByte
  CLR C
  SUBB A,t_Data1HighByte
  JC l_Data1_isGig

  ;This time, t_Data1HighByte = t_Data2HighByte. then continues
  ;comparing low byte.
  MOV A,t_Data1LowByte
  CLR C
  SUBB A,t_Data2LowByte
  JC l_Data1_isSmall

  ;This time, t_Data1LowByte >  = t_Data2LowByte.
  AJMP l_Data1_isGig

l_Data1_isSmall:SETB i_CompareFlag
  ;This time, t_Data1HighByte   < t_Data2HighByte, or
  ;t_Data1LowByte   < t_Data2LowByte.
  AJMP l_ExitCompare

l_Data1_isGig: CLR i_CompareFlag

l_ExitCompare: RET
;----------------------------------------------------------------------------
;功能:寻找跳变点。
f_DeteSaltation:JB i_CurrentLevel,l_CurrentIs1

l_CurrentIs0: JNB p_U2270B_OutPut,l_CurrentIs0
  JNB p_U2270B_OutPut,l_CurrentIs0
  JNB p_U2270B_OutPut,l_CurrentIs0
  JNB p_U2270B_OutPut,l_CurrentIs0
  JNB p_U2270B_OutPut,l_CurrentIs0
  AJMP l_ExitDetect

l_CurrentIs1: JB p_U2270B_OutPut,l_CurrentIs1
  JB p_U2270B_OutPut,l_CurrentIs1
  JB p_U2270B_OutPut,l_CurrentIs1
  JB p_U2270B_OutPut,l_CurrentIs1
  JB p_U2270B_OutPut,l_CurrentIs1

l_ExitDetect: MOV C,p_U2270B_OutPut
  MOV i_CurrentLevel,C ;保存当前电平
  RET
;----------------------------------------------------------------------------
f_ReadCard: CLR C
  MOV 00H,C

  JB p_U2270B_OutPut,f_ReadCard
  JB p_U2270B_OutPut,f_ReadCard
  JB p_U2270B_OutPut,f_ReadCard
  JB p_U2270B_OutPut,f_ReadCard
  JB p_U2270B_OutPut,f_ReadCard
  MOV C,p_U2270B_OutPut
  MOV i_CurrentLevel,C ;保存当前电平
  ;A
  LCALL f_DeteSaltation
  ;B
  MOV TH0,#0
  MOV TL0,#0
  SETB TR0
  LCALL f_DeteSaltation
  CLR TR0
  ;Current is C. Status is low level.

  MOV R6,TH0 ;Saves counter number.
  MOV R5,TL0 ;Saves counter number.

  MOV TH0,#0
  MOV TL0,#0
  SETB TR0

MOV 29H,R6
MOV 28H,R5

  MOV t_Data1HighByte,R6
  MOV t_Data1LowByte, R5
  MOV t_Data2HighByte,#01H
  MOV t_Data2LowByte, #04H
  LCALL f_Compare16Bit ;Affects flag CY and register A.

  JB i_CompareFlag,l_ErrorSignal
  ;At this time, BC >  = 0104H, counter number 0104H = 282us.

  LCALL f_DeteSaltation
  CLR TR0
  ;Current is D. Status is high level.

  MOV R6,TH0 ;Saves counter number.
  MOV R5,TL0 ;Saves counter number.

MOV 27,R6
MOV 26,R5

  MOV TH0,#0
  MOV TL0,#0

  MOV t_Data1HighByte,#00H
  MOV t_Data1LowByte, #0D4H
  MOV t_Data2HighByte,R6
  MOV t_Data2LowByte, R5
  LCALL f_Compare16Bit ;Affects flag CY and register A.

  ;#0D4H must >  = R6R5
  JB i_CompareFlag,l_ErrorSignal
  ;At this time, 0D4H >  = R6R5, namely,  0D4H >  = CD

  ;程序没有写完,暂时写这么多。

  CLR p_PNP_B ;声音提示。  ●●●●●●●●●●●●●●●●●●
  MOV t_DalayPara_3,#21
  MOV t_DalayPara_2,#130
  MOV t_DalayPara_1,#1
  LCALL f_delay   ;Delays 72 ms on 11.0592 MHz crystal.
  SETB p_PNP_B ;声音提示。  ●●●●●●●●●●●●●●●●●●

;=====================================
;Output two datas.
MOV A,29H
LCALL f_OutputA ;Affects the CY flag and register A.
MOV A,28H
LCALL f_OutputA ;Affects the CY flag and register A.

MOV A,27H
LCALL f_OutputA ;Affects the CY flag and register A.
MOV A,26H
LCALL f_OutputA ;Affects the CY flag and register A.

;=====================================

  AJMP l_ExitReadCard ;●●●●●●●●●●●●●●●●●●

l_ErrorSignal:  CLR TR0
  CLR C
  MOV 00H,C
  LJMP f_ReadCard

l_ExitReadCard: RET
;----------------------------------------------------------------------------
;purpose : When you test any program in this file, you can use the
;    f_OutputA subprogram to output the value of register A by
;    p_LED_GreenBig and p_LED_RED.
;p_LED_GreenBig : space signal.
;p_LED_RED : data signal.
;The communication protocol is as follows.
;p_LED_GreenBig : 4s    4s    4s    4s     ......and so on.
;p_LED_RED :    4s    4s    4s    4s  ......and so on.
;note  : 01,The red led is light, denotes 1. contrariwise denotes 0.
;    02,This subprogram affects the CY bit and register A.
;    03,The X5045P chip must be invalid, namely, let WD1 and WD0
;                    of X5045P all equal 1.
;for example : MOV A,#37H
;    LCALL f_OutputA ;Affects the CY flag and register A.
;    MOV A,#38H
;    LCALL f_OutputA ;Affects the CY flag and register A.
f_OutputA: MOV t_OutputCount,#8H

l_OutputLoop: CLR p_LED_GreenBig  ; The big led is light.
  MOV t_DalayPara_3,#221
  MOV t_DalayPara_2,#4
  MOV t_DalayPara_1,#29
  LCALL f_delay   ;Delays 4s on 11.0592 MHz crystal.

  RLC A
  JC l_BitIs_1
  SETB p_LED_GreenBig  ;The big led is extinguished.
  SETB p_LED_RED  ;The red led is extinguished.
  AJMP l_OutputDetect

l_BitIs_1: SETB p_LED_GreenBig  ;The big led is extinguished.
  CLR p_LED_RED

l_OutputDetect: 
  MOV t_DalayPara_3,#221
  MOV t_DalayPara_2,#4
  MOV t_DalayPara_1,#29
  LCALL f_delay   ;Delays 4s on 11.0592 MHz crystal.

  DJNZ t_OutputCount,l_OutputLoop

  CLR p_LED_GreenBig  ; The big led is light.

  CLR p_PNP_B
  MOV t_DalayPara_3,#21
  MOV t_DalayPara_2,#130
  MOV t_DalayPara_1,#1
  LCALL f_delay   ;Delays 72 ms on 11.0592 MHz crystal.
  SETB p_PNP_B

  RET
;----------------------------------------------------------------------------
;purpose : Delays for specified times.
;note  : At first, let t_DalayPara_3 and t_DalayPara_2 all equal 1, then 
;          change t_DalayPara_1. When t_DalayPara_1 is right, change 
;    t_DalayPara_2, at last, change t_DalayPara_3.
f_delay: DJNZ t_DalayPara_3,f_delay ;decimal parameter range:[1,255]
  DJNZ t_DalayPara_2,f_delay ;decimal parameter range:[1,255]
  DJNZ t_DalayPara_1,f_delay ;decimal parameter range:[1,255]
  RET
;----------------------------------------------------------------------------

;我的邮箱是:jhjbj@sohu.com


>>>>>>对该主题发表你的看法

本主题贴数4,分页: [第1页]


[上一篇主题]:[求助]maxplus+的license如果使用?小弟跪谢了

[下一篇主题]:消除回音