老古开发网首页
导航:老古开发网首页文章索引文章分类DSP数字信号处理→[C2000例程连载4]
| -文章搜索 - 最新文章 - |

C2000例程连载4

发布时间:2006年7月24日 点击次数:1181
来源:   作者:
 

一个关于TMS320LF2407异步串行例子

作者不详

这里有一个关于TMS320LF2407异步串行例子:(也适用于F240)
;===========================================================
* File Name: SCI.asm
* Description: PROGRAM TO PERFORM A LOOPBACK IN THE SCI  MODULE
* This program is capable of doing either an internal loopback or an external
* loopback, depending on the value written in SCICCR. SCITXD-SCIRXD pins
* should be connected together, if external loopback is desired. This is not
* required for an internal loopback. The SCI receives the bit-stream and stores
* the received data in memory (60h and above) for verification.
* An 8 bit value is transmitted through the SCITXD pin at a baud rate of
* 9600 bits/sec. A counter is used to determine how many times data is
* transmitted and received.
* This code is useful to determine the health of the SCI hardware quickly
* without the aid of any other equipment.
;===========================================================================
        .include 240x.h
        

KICK_DOG    .macro                ;Watchdog reset macro
        LDP      #00E0h
        SPLK     #05555h, WDKEY
        SPLK     #0AAAAh, WDKEY
        LDP      #0h
        .endm
;===========================================================================
; M A I N   C O D E  - starts here
;===========================================================================
        .text
START:        
        LDP     #0
        SETC    INTM            ; Disable interrupts
        LDP     #00E0h
        SPLK    #0040h,SCSR1        ; Enable clock for SCI module
        SPLK    #006Fh,WDCR        ; Disable WD
        KICK_DOG                
        SPLK    #0h,60h            ; Set wait state generator for:
        OUT     60h,WSGR        ; Program Space, 0-7 wait states        
                         
;===========================================================================
;SCI TRANSMISSION TEST - starts here
;===========================================================================
        
SCI:        LDP     #0E1h            
        SPLK    #0003h,MCRA
        LAR     AR0, #SCITXBUF        ; Load AR0 with SCI_TX_BUF address
        LAR     AR1, #SCIRXBUF        ; Load AR1 with SCI_RX_BUF address
        LAR     AR2, #1Fh        ; AR2 is the counter
        LAR     AR3, #60h        ; AR3 is the pointer
        
        LDP     #SCICCR>>7
        SPLK    #17h, SCICCR        ; 17 for internal loopback
                        ; 07-External. For external option JP12=2-3
                        ; 1 stop bit,odd parity,8 char bits,
                        ; async mode, idle-line protocol
        SPLK    #0003h, SCICTL1        ; Enable TX, RX, internal SCICLK,
                        ; Disable RX ERR, SLEEP, TXWAKE
        SPLK    #0000h, SCICTL2        ; Disable RX & TX INTs
        SPLK    #02h, SCIHBAUD
        SPLK    #08h, SCILBAUD            ; Baud Rate=9600 b/s (40 MHz SYSCLK)
        SPLK    #0023h, SCICTL1        ; Relinquish SCI from Reset.

XMIT_CHAR:    LACL    #61h            ; Load ACC with xmit character
        MAR    *,AR0
        SACL    *,AR1            ; Write xmit char to TX buffer

        
XMIT_RDY:    BIT     SCICTL2,BIT7        ; Test TXRDY bit
        BCND    XMIT_RDY,NTC        ; If TXRDY=0,then repeat loop

RCV_RDY:    BIT     SCIRXST,BIT6        ; Test RXRDY bit
        BCND    RCV_RDY,NTC        ; If RXRDY=0,then repeat loop

READ_CHR:    LACL    *,AR3            ; The received (echoed) character is
                        ; stored in 60h
        SACL    *+,AR2            ; This loop is executed 20h times
        BANZ    XMIT_CHAR        ; Repeat the loop again

LOOP        B    LOOP            ; Program idles here after executing
                        ; transmit loops
        .end


欢迎进入老古论坛进行讨论
[DSP数字信号处理] 相关文章:
C2000例程连载2
简介:
TMS320F243的编程例子 作者不详 /*****************************************************************************/ /* Testprogram for digital I/O on Port D */ /* running on TMS320F243 EVA-Board, PLL is fixed to multiply by 4 */ /* external clock is 5MHz, internal then 20Mhz */ /* date : 07/11/2000 , (C) ......

C2000例程连载1
C/C++中多维数组指针作为函数参数传递!
如何用C语言开发DSP嵌入式系统(肖宛昂 曾为民)
德州仪器以3.25 美元的最低售价推出业界最低成本 32 位数字信号控制器
基于DSP和CPLD的宽带信号源的设计
2000系列dsp的MP/MC管脚[YC]
基于DSP与双目CMOS摄像头的数字图像处理系统
基于DSP的小型直流风扇自动化测试系统
一种纸币识别系统的设计
 
下一个:[DSP数字信号处理]C2000例程连载3
简介:
S320F2812的延时程序 作者不详 .def _DSP28x_usDelay ;==================================================== ;Delay Function ;The C assembly call will look as follows: ; ; extern void Delay(long time); &nb......
 

上一个:[DSP数字信号处理]C2000例程连载6

老古开发网版权所有 2006年9月 asp.Net V2.0 设计:老古
页面缓存:10分钟 执行时间:31毫秒