完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
任何一个都有一个非常基本的程序,所以PIC16F1937可以读取TC47 ADC的温度。没有错误检查等,只是熊骨头。谢谢BP
以上来自于百度翻译 以下为原文 Would any one have a very basic program so a pic16f1937 can just read the temp of the Tc47 ADC. No error checking etc, just the bear bones. Thanks bp |
|
相关推荐
6个回答
|
|
TC74也许我在PIC16上广泛使用比特敲击汇编代码,然后在几个平台上使用C。
以上来自于百度翻译 以下为原文 TC74 maybe I used it extensively using bit banged assembly code on a PIC16, and then in C on several platforms. |
|
|
|
嗨,CinziaG,我还没有使用BIT BAM组件,但我可以把它转换成PIC组件。如果可能的话,你能在汇编和C中给出代码吗?谢谢BP
以上来自于百度翻译 以下为原文 Hi, CinziaG, I haven't used bit bang assembly but I may be able to convert it to pic assembly . Would you be able to give code in Assembly and C if possible? Thank you Bp |
|
|
|
我可以试试张贴它!(我想我过去已经做过了,但是让我们再试一次……)
以上来自于百度翻译 以下为原文 I can try posting it! (I think I already did in the past but let's try again...) |
|
|
|
I2C SW代码:
以上来自于百度翻译 以下为原文 I2C SW code: SPI_232_O equ Led3OBit ; anche SPI Clk SPI_232_I equ Puls4Bit ; anche SDA/SDI DoI2CStart: ; Master, start (CLK negativo) bsf PORTB,SPI_232_I ; imposto DATA=1 e CLK=0 call setDataOutput ; OCCHIO a manipolare PORTB che e' I/O! (v. anche IRQ) ; bcf PORTA,SPI_232_O ; CLK=0 ... e' gia' cosi' ... call Delay_SPI call setClockHigh ; CLK=1 (qui sarebbe giusto, + che aspettare, dare errore BUS_ARBITRATION...) call Delay_SPI bcf PORTB,SPI_232_I ; DATA=0 ; data line goes low during high clock for start bit call Delay_SPI bcf PORTA,SPI_232_O ; CLK=0 goto Delay_SPI DoI2CStop: ; Master, stop (CLK negativo) (non usato con SHT11) ; (SHT11 non e' del tutto I2C compatibile ...) call setDataOutput ; bcf PORTA,SPI_232_O ; CLK=0 ... e' gia' cosi'... bcf PORTB,SPI_232_I ; DATA=0 ; OCCHIO a manipolare PORTB che e' I/O! (v. anche IRQ) call Delay_SPI call setClockHigh ; CLK=1 call Delay_SPI bsf PORTB,SPI_232_I ; DATA=1 ; data goes high while clock high for stop bit call Delay_SPI call setClockHigh ; CLK=1 ; questa e' un'altra attesa, per i dispos. (tipo PICBELL, PICWDI2C) che il WAIT lo fanno DOPO lo STOP! goto Delay_SPI DoI2CMI: ; Master, input (CLK negativo): esce in W il byte se C=0 o C=1=errore ; entra W=1 se bisogna dare ACK allo slave o 0 se no ; PRIMA fare DoI2CStart!! movwf temp2 movlw 8 movwf tempC call setDataInput DoI2CMI_: ; clrwdt ; gia' in Delay_uS call Delay_SPI ; call setClockHigh ; CLK=1 fare? boh? bsf PORTA,SPI_232_O call Delay_SPI ; btfss PORTB,SPI_232_I ; inutile... bcf STATUS,C btfsc PORTB,SPI_232_I bsf STATUS,C rlf temp,f ; MSB first bcf PORTA,SPI_232_O decfsz tempC,f goto DoI2CMI_ call setDataOutput movf temp2,f ; invio ACK come richiesto (Z=1 se stop cioe' ACK=1, Z=0 cioe' ACK=0) btfss STATUS,Z bcf PORTB,SPI_232_I ; DATA=0 btfsc STATUS,Z bsf PORTB,SPI_232_I ; DATA=1 bsf PORTA,SPI_232_O call Delay_SPI bcf PORTA,SPI_232_O call Delay_SPI movfw temp return DoI2CMO_INDF: movfw INDF DoI2CMO: ; Master, output (CLK negativo): entra in W il byte ; PRIMA fare DoI2CStart!! movwf temp movlw 8 movwf tempC call setDataOutput DoI2CMO_: ; clrwdt ; gia' in Delay_uS rlf temp,f ; MSB first btfss STATUS,C bcf PORTB,SPI_232_I ; DATA=0 btfsc STATUS,C bsf PORTB,SPI_232_I ; DATA=1 call Delay_1uS ; serve un minimo di ritardo tra il settaggio di DATA e la salita di CLK bsf PORTA,SPI_232_O call Delay_SPI bcf PORTA,SPI_232_O call Delay_SPI decfsz tempC,f goto DoI2CMO_ call setDataInput call Delay_SPI call setClockHigh ; aspetto ACK ; Per WAIT_STATE dello slave (CLK basso)... NON e' chiaro se PRIMA o DOPO ACK... (PicBell lo fa dopo!) ; questo lo controlla SEMPRE! call Delay_SPI ; dopo Delay, qua arrivo con W=0 e Z=1 btfsc PORTB,SPI_232_I addlw -1 ; Z=1 se ACK=OK (basso), altrimenti Z=0 e W!=0 bcf PORTA,SPI_232_O return |
|
|
|
从TC74读取的C代码:
以上来自于百度翻译 以下为原文 C code that reads from a TC74: signed int leggi_temp(BYTE q) { // in decimi °C WORD n; DoI2CStart(); DoI2CMO(0x90 | (q << 1)); // mando address (FORZO WR) DoI2CMO(0); DoI2CStart(); DoI2CMO(0x91 | (q << 1)); // mando address (FORZO RD) n=DoI2CMI(0); DoI2CStop(); // if(!n || n==0xffff) // segnalo errore se chip guasto su TC74 no! // return INVALID_READOUT; n*=10; return n; } |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
733浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
505浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 06:07 , Processed in 1.314346 second(s), Total 88, Slave 72 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号