pic內含<比較器>的具體用法
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
一些內含<比較器>的pic系列,像是pic10f,這些比較器有什麼較具體實際的應用嗎?
有app. note可參考嗎? 為什麼pic10f一做就內含兩組,是否真的很好用.
發表於: 2004/7/10 10:29
|
|||
|
有關PIC18系列字串存取指令(組合語言)
|
||||
---|---|---|---|---|
高級會員
![]() ![]() |
請問各位大大
小弟最近在學18系列的組合語言,發現Data Memory <-> Program Memory的八個指令看不懂,而且Workshop的範例看的不是很了解,請各位大大是否有相關的範例或是網站 Ex. TBLRD* or TBLRD*+ or TBLRD*- or TBL+* or TBLWT* or TBLWT*+ or TBLWT*- or TBLWT+* 謝謝各位!
發表於: 2004/7/9 14:35
|
|||
|
Re: 請問dspic是否可擴充ram
|
||||
---|---|---|---|---|
版主
![]() ![]() |
dsPIC 目前無法直接擴充RAM及ROM,但可以用I/O模擬的方式擴充,dsPIC6014有70個I/O腳可以直接外掛RAM,到是可以考慮看看。
PIC18F8x20 等 80-pin的MCU 及PIC18C601 , 18C801 就可以外掛ROM或RAM,詳細應用請參考AN869
發表於: 2004/7/9 11:31
|
|||
|
Re: ICD2連線dsPIC30F2010的問題
|
||||
---|---|---|---|---|
版主
![]() ![]() |
經你這麼一提醒,我把我手上的 ICD2 通通拆開來看。
只有最新版的 Revision 7 (第七版) 才有 R23,R36 兩個串聯電阻,其它的舊版本沒有這兩個電阻就不用修改。 也就是說,如果你的 ICD2 可以正常連接dsPIC30F2010的話就不用修改,如無法正確連線時再拆開來看看。 謝謝 ![]() ![]()
發表於: 2004/7/9 11:20
|
|||
|
請問dspic是否可擴充ram
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
版主您好:
最近要處理一張小影像(需20K),由於處理過程運算很簡單,影像亦很小,所以想試看看dspic可否完成,但是6014的ram不夠大(dspic6014才8K的RAM),所以想請教版主是否有支援擴充RAM的dspic或pic18也行,最好可以用bus來存取資料,謝謝,感謝您的回應。 ![]()
發表於: 2004/7/9 11:03
|
|||
|
Re: 兩種差異在哪裡呢..
|
||||
---|---|---|---|---|
新會員
![]() ![]() |
謝謝這位先生解答...感恩...!!
![]()
發表於: 2004/7/9 11:02
|
|||
|
Re: 兩種差異在哪裡呢..
|
||||
---|---|---|---|---|
版主
![]() ![]() |
以上程式的定義語法是錯誤的,正確語法應為:
#define SW0 PORTBbits.RB0 SW0習慣上採用大寫,以和變數有所區別。 在C語言中,"==" 是條件判斷,其結果只有成立(不等於零)或不成立(等於零)兩種。 而單一的"=" 是指定運算,它會改變=左邊的數值。
發表於: 2004/7/9 10:46
|
|||
|
Re: dsPIC30F6014的RS232傳送單一字元
|
||||
---|---|---|---|---|
版主
![]() ![]() |
發表於: 2004/7/9 10:32
|
|||
|
Re: dsPIC30F6014的RS232傳送單一字元
|
||||
---|---|---|---|---|
版主
![]() ![]() |
送一段RS-232與A/D的範例程式參考看看:
.equ __30F6014, 1 .include "C:\Program Files\MPLAB IDE\dsPIC_Tools\support\inc\p30f6014.inc" ;------------------------------------------------------------------------------ ;Program Specific Constants (literals used in code) .equiv FCY, 1000000 ;Instruction Cycle Frequency .equiv BAUDRATE, 2400 ;Operating Baud Rate .equiv DelayConst, FCY/2000 ;------------------------------------------------------------------------------ ;Global Declarations: .global __reset ;Declare the label for the start of code .global __U1TXInterrupt ;Declare USART1 TX ISR name global ; ;Assign ram space for register Flag .section .nbss .align 2 DelayReg: .space 2 ;------------------------------------------------------------------------------ ;Code Section in Program Memory .text ;Start of Code section __reset: mov #__SP_init, W15 ;Initalize the Stack Pointer mov #__SPLIM_init, W0 mov W0,SPLIM ;Initialize the Stack Pointer Limit Register nop ;Add NOP to follow SPLIM initialization clr W0 ;Initialize Working registers to 0x0000 mov W0,W14 ;clr working registers w0 to w14 repeat #12 mov W0,[++W14] clr W14 ;------------------------------------------------------------------------------ RCALL InitADC12 ; Initialize the ADC RCALL Init_USART1 ;initialize USART1 for Tx interrupt at 2400 baud Again: bset ADCON1,#SAMP ; start sampling ... mov #10,w0 ; delay for mov w0,DelayReg ; for 10 mS rcall DelayNmSec ; / bclr ADCON1,#SAMP ; start Converting ADCdone: btss IFS0,#ADIF ; conversion done? bra ADCdone ; no then keep checking rcall SendADC ; Load buffer and transmit bra Again ;repeat again ; ;----------------------------------------------------------------------------- ;Subrotuinte to Init Ports pins connected to LED1 to LED4 ;------------------------------------------------------------------------------ Init_PORTS: clr LATD mov #0xFF0F,W0 ; set RD7 to RD4 as outputs mov W0,TRISD return ; ;InitUSART1, subroutine initializes the USART ; ; Init_USART1: clr U1MODE clr U1STA bset U1MODE, #UARTEN ;Enable UART (implies reception) mov #(((FCY/BAUDRATE) / 16) - 1), w0 mov w0, U1BRG ;Initialize BRG bclr IFS0, #U1TXIF ;Clear the interrupt flag bclr IEC0, #U1TXIE ;Disable ISR processing bset U1STA, #UTXEN ;Enable Transmission return ; ; ;******************************************************************* ; Below is the code required to setup the ADC registers for : ; 1. 1 channel conversion (in this case RB2/AN2) ; 2. Manual Sample start ; 3. User specified sampling delay (100mS in this case) ; 4. Manual Stop Sampling and start converting ; 5. Manual check of Conversion complete ; ; The code is as per Figure 18-3 in the Ref. manual ;********************************************************************* InitADC12: mov #0xfffb,w0 ;all PORTB = Digital; RB2 = analog mov w0,ADPCFG clr ADCON1 ; SAMP bit = 0 ends sampling ... ; and starts converting mov #0x0002,w0 ; Connect RB2/AN2 as CH0 input .. mov w0,ADCHS ; in this example RB2/AN2 is the input clr ADCSSL mov #0x0002,w0 ; Manual Sample, Tad = internal 2 Tcy mov w0,ADCON3 clr ADCON2 bset ADCON1,#ADON ; turn ADC ON return ; ;------------------------------------------------------------------------------ ;DelayNmSec, delays the value in the DelayReg in mSecs at a given Mip rate ; DelayNmSec: do #DelayConst,DIL nop DIL: nop dec DelayReg bra nz,DelayNmSec return ; ;----------------------------------------------------------------------------- ;SendADC, sends 5 charaters to the U1TXREG buffer for transmission. The ;first 3 values are the hex code for the 12 bit ADC value. The last two are ;the CR and LF characters ; SendADC: mov ADCBUF0,w0 ;get ADC value swap w0 ;swap low and high bytes rcall GetAscii ;get the ascii value rcall LoadAscii ;load the ascii value mov ADCBUF0,w0 ;get ADC value swap.b w0 ;swap low and high nibbles of LSB rcall GetAscii ;get Ascii value rcall LoadAscii ; load ascii value mov ADCBUF0,w0 ;get ADC value rcall GetAscii ;get ascii value rcall LoadAscii ;load ascii value mov #0x000A,w0 ;load a CR rcall LoadAscii ; / mov #0x000D,w0 ;load LF rcall LoadAscii ; return ; ;GetAscii, takes the value in w0 and uses the 4 LS bits and ;converts them to a hex value (0 to F) in w0. Next it ;converts the hex value in w0 to an ascii displayable character GetAscii: mov #0x000F,w1 ;mask all but the low 4 bits and w0,w1,w0 ; / cp.b w0,#10 ;compare with 10 bra n,Add30hex ;< 10 the add 30 hex add #0x37,w0 ;>= 10 then add 0x37 to make into ascii ; character (A to F) return Add30hex: add #0x30,w0 ;add 0x30 to make ascii number (0 to 9) return ; ;LoadAscii, takes the ascii value in w0 and loads it into ;the U1RXBUF if there is room in the buffer. LoadAscii: btsc U1STA,#UTXBF ;buffer empty then skip bra LoadAscii ; keep looking if full mov w0,U1TXREG ;load the buffer return ; ;------------------------------------------------------------------------------ .end ;End of code in this file
發表於: 2004/7/9 9:59
|
|||
|