搜索
熱搜: 活動 交友 discuz
查看: 9216|回復: 0
打印 上一主題 下一主題

[求助] 有關TMS320 VC33 DSP晶片上,所用的1個C語言程式問題 幫修改

[複製鏈接]
跳轉到指定樓層
1#
發表於 2009-5-25 21:02:17 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
這個晶片是
STC-VC33
TMS320
VC33
DSP
以上是這晶片的介紹
我要執行1個程式
程式內容是
/* file: DAC_square */
#include "stdio.h"
void delay(int time);
void set_timer0_freq(int freq);
volatile unsigned int *AD_CS=(unsigned int*)0xc00000;
volatile unsigned int *CMD_LD=(unsigned int*)0xc06000;
volatile unsigned int *LATCH_OE=(unsigned int*)0xc07000;
volatile unsigned int *DA0_CS= (unsigned int*) 0xc01000;
volatile unsigned int *DA1_CS= (unsigned int*) 0xc01001;
volatile unsigned int *DA2_CS= (unsigned int*) 0xc01002;
volatile unsigned int *DA3_CS= (unsigned int*) 0xc01003;
volatile unsigned int *strb=(unsigned int*)0x808064;
volatile long *TMR0_CTRL   = (long*) 0x808020;
volatile long *TMR0_CNT    = (long*) 0x808024;
volatile long *TMR0_PERIOD = (long*) 0x808028;
#define volt_offset 0.3;

int a=0, Flag=0, Amplitude=1;
int L;
/**/
       printf("\Please enter the frequency");
       scanf("%d",&L);
/**/   
main()
{      
*strb=0xf10b8;
asm("\tLDI 0h,IF");
asm("\tLDI 0h,IE");        
set_timer0_freq(2*L) ;
delay(100);
asm("\tor 2000h,ST");
asm("\tor  100h,IE");
delay(100);   
  
while(1)
{   a++;  }
}         

void c_int99(void)
{ }        
void c_int09(void)
{
if (Flag==0)
   {   *DA0_CS=3276*Amplitude+32768+3276*volt_offset;
        Flag=1; }
else
   {   *DA0_CS=-3276*Amplitude+32768+3276*volt_offset;
       Flag=0; }
asm("\t NOP");
asm("\t NOP");         
}        


void delay(int time )
{
  int a;
  for(a=0;a<time;a++);
}   

void set_timer0_freq(int freq)   
{
*TMR0_PERIOD=30000000/freq;  
*TMR0_CTRL =0x2c1;
}

以上執行結果,會出現1個視窗詢問"Please enter the frequency"
要求我輸入frequency
這樣在示波器上就會出現我所輸入的frequency值
我想要在以上程式在加入個可以輸入duty cycle
要讓他會在詢問我"Please enter the duty cycle"
並且我輸入duty cycle的值後,是正確的
請求各位大大協助
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

本論壇為非營利之網路平台,所有文章內容均為網友自行發表,不代表論壇立場!若涉及侵權、違法等情事,請告知版主處理。


Page Rank Check

廣告刊登  |   交換連結  |   贊助我們  |   服務條款  |   免責聲明  |   客服中心  |   中央分站

手機版|中央論壇

GMT+8, 2024-4-19 11:36 , Processed in 0.016648 second(s), 17 queries .

Powered by Discuz!

© 2005-2015 Copyrights. Set by YIDAS

快速回復 返回頂部 返回列表