正文

cs55502006-03-13 17:51:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/botao/10972.html

分享到:

;*********************************************************** ;This is basic programs for CS5550A EVALUATE-BOARD ;condition:12MHz,CPU[51] ;Write by RockChen on 2002.1.17 in HoneStar ;*********************************************************** cs  equ p1.0 sdi  equ p1.1 sdo  equ p1.2 sclk  equ p1.3 int  equ p3.3 ;byte======================================================= tempa  equ 30h temph  equ 31h tempm  equ 32h templ  equ 33h ;***********************************************************   org 00h   ljmp start   org 30h    start:          clr cs   lcall   init5550a    main:   mov a,#0ah  ;read cc         lcall writebyte ;send command   lcall readbyte ;receive bytes high byte first   mov temph,a     lcall readbyte   mov tempm,a     lcall readbyte   mov templ,a  ;exampl:read cc                 ljmp    main ;*********************************************************** ;=========================================================== ;In: ;Out: ;Use: r1,2sp ;Note:  ;=========================================================== init5550a: clr ex1  ;close int adin   setb sdo   clr sdi   clr sclk     mov r1,#63   setb    sdi             ;reset serial port init541: setb sclk   clr sclk   djnz r1,init541   clr sdi   setb sclk   clr sclk  ;make converter in command mode      mov a,#0e8h  ;0e0h start 5550a with single   lcall writeByte ;0e8h start 5550a with continu      setb ex1   ret ;=========================================================== ;In: none ;Out: a ;Use: a,r1 ;Note: read one byte[a] from cs5550a ;=========================================================== readbyte: mov     r1,#08  ;set count   setb sdi  ;set sdi to avoid inadvertent    readbyte1: mov     c,sdo  ;read msb first   rlc     a   setb    sclk   nop   clr     sclk   djnz    r1,readbyte1   ret ;=========================================================== ;In: a ;Out: none ;Use: a,r1 ;Note: send one byte[a] to cs5550a ;=========================================================== writebyte: mov     r1,#08   ;set count   clr     sclk writebyte1: rlc     a        ;send msb first   mov     sdi,c   nop   setb    sclk   nop   clr     sclk   djnz    r1,writebyte1   setb sdi  ;to one when not transmitting     ret ;***********************************************************   end  

阅读(3795) | 评论(4)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册