色婷婷AⅤ一区二区三区|亚洲精品第一国产综合亚AV|久久精品官方网视频|日本28视频香蕉

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 深入理解ARM體系架構(gòu)(S3C6410)---PWM實(shí)例

          深入理解ARM體系架構(gòu)(S3C6410)---PWM實(shí)例

          作者: 時間:2016-11-09 來源:網(wǎng)絡(luò) 收藏
          S3C6410X中有5個定時器,這些定時器產(chǎn)生內(nèi)部中斷。其中,Timer0和Timer1具有PWM功能,而Timer2,3,4沒有此功能。

          The S3C6410X RISC microprocessorcomprises of five 32-bit timers. These timers are used to generate internal interruptsto the ARM subsystem. In addition, Timers 0 and 1 include a PWM function (PulseWidth Modulation),which can drive an external I/O signal. The PWM for timer 0and 1 have an optional dead-zone generator capability, which can be utilized tosupport a large current device. Timer 2, 3 and 4 are internal timers with no outputpins.

          本文引用地址:http://cafeforensic.com/article/201611/317827.htm

          PWM具有兩種操作模式:自動裝載模式,一次觸發(fā)模式。為實(shí)現(xiàn)PWM功能,芯片提供了16個功能寄存器。這些功能寄存器都連接APB總線。

          總體架構(gòu)圖如下:

          S3C6410X中有5個定時器,這些定時器產(chǎn)生內(nèi)部中斷。其中,Timer0和Timer1具有PWM功能,而Timer2,3,4沒有此功能。定時器具有雙緩沖特性,這樣就能在不停止當(dāng)前定時器操作的情況下,為下次定時器運(yùn)行裝入新的數(shù)值。盡管為定時器設(shè)置了新數(shù)值,但當(dāng)前的定時操作能夠成功完成。定時器從TCNTBn讀取的值是為下次延時定時用的,并不影響當(dāng)前定時器的運(yùn)行。當(dāng)TCNTn減小到0的時候,TCNTBn的值會自動復(fù)制到TCNTn中,這就是說的自動裝載操作。定時器的當(dāng)前技術(shù)數(shù)值可以從定時計數(shù)觀察寄存器中TCNTOn讀取。如果TCNTn為0且從裝載也為0的話則TCNTn不在進(jìn)行下次操作。

          寄存器介紹:

          1、總寄存器映射圖

          2、TCFG0寄存器:

          3、TCFG1寄存器:

          4、TCON控制寄存器:

          mini6410蜂鳴器原理圖:

          定義寄存器:


          1. #definerTCFG0(*(volatileunsigned*)(0x7F006000))
          2. #definerTCFG1(*(volatileunsigned*)(0x7F006004))
          3. #definerTCON(*(volatileunsigned*)(0x7F006008))
          4. #definerTCNTB0(*(volatileunsigned*)(0x7F00600C))
          5. #definerTCMPB0(*(volatileunsigned*)(0x7F006010))
          6. #definerTCNTO0(*(volatileunsigned*)(0x7F006014))
          7. #definerTCNTB1(*(volatileunsigned*)(0x7F006018))
          8. #definerTCMPB1(*(volatileunsigned*)(0x7F00601c))
          9. #definerTCNTO1(*(volatileunsigned*)(0x7F006020))
          10. #definerTCNTB2(*(volatileunsigned*)(0x7F006024))
          11. #definerTCNTO2(*(volatileunsigned*)(0x7F00602c))
          12. #definerTCNTB3(*(volatileunsigned*)(0x7F006030))
          13. #definerTCNTO3(*(volatileunsigned*)(0x7F006038))
          14. #definerTCNTB4(*(volatileunsigned*)(0x7F00603c))
          15. #definerTCNTO4(*(volatileunsigned*)(0x7F006040))
          16. #definerTINT_CSTAT(*(volatileunsigned*)(0x7F006044))

          編寫初始化函數(shù):


          1. voidinit_pwm()
          2. {
          3. rGPFCON&=~(0x3U<<28);
          4. rGPFCON|=(0x2U<<28);
          5. rTCFG0&=~0xff;
          6. rTCFG0|=(50-1);
          7. rTCFG1=0x4;
          8. #definefreq800
          9. rTCNTB0=(133000000/50/16)/freq;
          10. rTCMPB0=rTCNTB0/2;
          11. rTCON&=~0x1f;
          12. rTCON|=0xb;//disabledeadzone,auto-reload,inv-off,updateTCNTB0&TCMPB0,starttimer0
          13. rTCON&=~2;//clearmanualupdatebit
          14. }

          在main函數(shù)中:


          1. init_pwm();
          2. while(1);



          關(guān)鍵詞: ARM體系架構(gòu)S3C6410PW

          評論


          技術(shù)專區(qū)

          關(guān)閉