完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我想把ADC1BUF0的内容读到并行端口,特别是dspic33fj128mc802上的RB[15:0]。我知道这个芯片有PPS特性,它把外围输出路由到RP引脚。但是,ADC1BUF0不是外围设备。在将TRISB位设置为零之后,我如何将ADC1BUF0输出到RB[15:0]????任何帮助都是值得赞赏的。
以上来自于百度翻译 以下为原文 Hello everyone, I am trying to read the contents of ADC1BUF0 to parallel port, specifically to RB[15:0] on dspic33fj128mc802. I know that this chip has PPS feature which routs the peripheral outputs to RP pins. But, ADC1BUF0 is not a peripheral. After I set the TRISB bits to all zeros, how am I going to bring out ADC1BUF0 output to RB[15:0]??? Any help is appreciated. |
|
相关推荐
13个回答
|
|
您好,下面的链接可能有助于YouHTTP//WW1.MICCHIP.COM/DeLoSt/En/DeVICECDOC/70183D.PDF16-8页第60页-TS9
以上来自于百度翻译 以下为原文 Hello, Below link may help to you http://ww1.microchip.com/downloads/en/DeviceDoc/70183D.pdf Example 16-8 on Page 60 -- TS9 |
|
|
|
您不能直接连接它们。您需要编写代码来循环,读取ADC1BUF0寄存器,并将数据写入LATB。
以上来自于百度翻译 以下为原文 You can't directly connect them. You will need to write code to loop around, reading the ADC1BUF0 register, and writing the data to LATB. |
|
|
|
谢谢你,QHB。它奏效了!我猜,如果您想写到一个“可写”寄存器,可以通过并行总线访问,但不是在PPS列表上,那么首先您将值写到PORTB,然后从PORTB写到这个可写寄存器?
以上来自于百度翻译 以下为原文 Thank you, qhb. It worked! I am guessing if you want to write to a "writable" register accessible thru the parallel bus but not on the PPS list, first you write the value to the PORTB and then from PORTB to this writable register? |
|
|
|
|
|
|
|
嗨,Bedder,LATB=ADC1BUF0没有问题;我实现了,它工作正常。我在问反过来会发生什么,也就是说,您想从RB管脚写入处理器中的可写寄存器。例如:假设RegX是可写寄存器,可以执行以下操作:PORTB=23;RegX=PORTB;23岁的RegX?
以上来自于百度翻译 以下为原文 Hi Bedder, No problems with LATB = ADC1BUF0; I implemented and it worked. I was asking what happens the other way around, i.e. you want to write into a writable register in the processor from RB pins. Ex: Suppose RegX is a writable register, can you do the following: PORTB = 23; RegX = PORTB; so it writes 23 to RegX? |
|
|
|
是否有一些未说明的原因,为什么你不只是DOREGX=23;为什么PoTB必须参与?
以上来自于百度翻译 以下为原文 Is there some un-stated reason why you wouldn't just do RegX = 23; why does PORTB have to be involved? |
|
|
|
我感觉误会来自上面的帖子…
以上来自于百度翻译 以下为原文 I have the feeling that misunderstanding comes from posts above... |
|
|
|
你好,windsurfingphd,在message#1中,你确实问过关于读ADCBUF0寄存器的问题。“to RB[15:0]”的意思是写到PORT寄存器。在message#6中,你已经回答了自己的问题。注意,写到PORTB寄存器是不可能的。当你把数据写到PORTB寄存器的地址时,数据就变成了数据。实际上是重新路由到LATB寄存器,参见图11-1端口的数据表框图。写入PORTB寄存器,然后从PORTB读取,通常没有意义,并且通常不鼓励这样做,除非您想验证预期的输出实际上作为输出信号出现在I/O引脚上。r为了成功,必须将所有涉及的I/O管脚设置为Output,必须禁用RB0到RB3管脚上的模拟属性,必须禁用二级振荡器,必须禁用JTAG,必须禁用可以直接使用这些管脚的任何外围设备,并且不能将任何其他使用PPS的外围设备路由到P在写到端口B锁存寄存器之后,必须经过足够的时间让输出驱动器对任何外部布线充电,并且必须通过输出驱动器和数字输入缓冲器中的传播延迟的时间。然后,可以尝试读取PORTB寄存器,并与期望值进行比较。伊西尔
以上来自于百度翻译 以下为原文 Hi windsurfingphd, In message #1, you did ask about reading ADCBUF0 register. "to RB[15:0]" means writing to the PORT register. In message #6 you have turned your own question around. Note, that writing to PORTB register is Not really possible. When you write data to the address of PORTB register, data are actually rerouted to LATB register, see Datasheet block diagram of Port Figure 11-1. Writing to PORTB register, and then reading from PORTB, do not usually make sense, and is generally discouraged, unless you want to verify that your intended output actually appear as output signals on I/O pins. For this to succeed, All I/O pins involved must be set to Output, Analog properties on RB0 to RB3 pins must be disabled, Secondary oscillator must be disabled, JTAG must be disabled, any peripheral that may use these pins directly must be disabled, and no other peripheral using PPS may be routed to PORTB pins. After writing to Port B Latch register, sufficient time must pass for output drivers to charge any external wiring, and time for propagation delay in output drivers and in digital input buffers, must pass. Then, you may try to read PORTB register, and compare with expected value. Regards, Mysil |
|
|
|
好吧,伙计们,实际上有2个问题,正如Mysil指出的那样。很抱歉在我以前的帖子中给你带来了困惑。案例1:我正在阅读ADC1BUF0到RB[15:0]。解决方法:我做了LATB= ADC1BUF0,它起作用了!这里不再有问题。现在,从相反的角度来看下一个问题:案例2:我在物理引脚上写一个“硬连线”的值,Rb[15:0]=0000,0000,0001,0111=23,这是RegX在DSSPIC33中的一个寄存器。我编写了TrISB= 0xFFFF来设置所有的RBS作为输入。我能做什么使硬连线Rb[15:0]=23到RegX?因为我从PORTB寄存器读取输入,所以我认为下面的技巧是:PoBB=23;RegX=PORTB;我只做RegX=23,TrISB= 0xFFFF语句是否足够好,将Rb[15:0]的硬连线值捕获到ReGX中?愚蠢的问题,我知道:
以上来自于百度翻译 以下为原文 Ok guys, there are actually 2 questions as Mysil pointed out. Sorry to give you the confusion in my previous posts. Case 1: I am reading ADC1BUF0 to RB[15:0]. Solution: I did LATB = ADC1BUF0, and it worked! No more questions here. Now, the next question from the opposite angle: Case 2: I am writing a "hardwired" value on the physical pins, RB[15:0] = 0000 0000 0001 0111 = 23 to a register inside dspic33f, say RegX. I wrote TRISB = 0xFFFF to set all RBs as inputs. What do I do to get the hardwired RB[15:0] = 23 to RegX? Since I read inputs from the PORTB register, I thought the following would do the trick: PORTB = 23; RegX = PORTB; I simply do RegX = 23, would TRISB = 0xFFFF statement be good enough to capture the hardwired values on RB[15:0] into RegX? Dumb question, I know :-) |
|
|
|
你指的是硬连线的价值究竟是什么?你用那种模式把那些针连接得很高和很低吗?如果是,那么这样做是没有意义的:PORTB=23;只是doRegX=PORTB;如果希望能够读回写入PORT的值,那么必须将管脚声明为输出,而不是输入,或者必须从匹配的LATx寄存器(在本例中为LATB,但是它没有反映在什么上)读取管脚。针,为什么要使用那些寄存器?
以上来自于百度翻译 以下为原文 What EXACTLY do you mean by a hardwired value? Have you connected those pins high and low in that pattern? If yes, then it's pointless to do: PORTB = 23; just do RegX = PORTB; If you want to be able to read back a value you have written to a PORT, then the pins must be declard as outputs, not inputs, or you must read from the matching LATx register (LATB in this case, but then it's not reflecting what is on the pins, so why use a those registers at all?) |
|
|
|
试试这个:但我还是弄不明白你想达到什么目的,你说“我正在物理引脚上写“硬连线”值是什么意思,RB[15:0]=00000000000010111=23到dspic33f内的寄存器,比如RegX”-请详细说明。
以上来自于百度翻译 以下为原文 Try this: TRISB = 0xFFFF; LATB = 23; RegX = LATB; But I still can't figure out what would you like to achieve and what do you mean by "I am writing a "hardwired" value on the physical pins, RB[15:0] = 0000 0000 0001 0111 = 23 to a register inside dspic33f, say RegX." - please elaborate. |
|
|
|
谢谢你,QHB和Bead。这只是一个理解I/O功能的练习。其目的是能够将值写入到不在PPS输入列表中的“可写”寄存器中。在这个例子中,由于RB引脚直接连接到接地和VDD,使得Rb[15:0]=23,所以我认为按照QHB建议做以下操作是有意义的:TrISB=0xFFFF;Rexx=PoLTB;图11-1中的电路当然清除了所有的东西。当心。
以上来自于百度翻译 以下为原文 Thank you, qhb and Bedder. This is only an exercise to understand the I/O functionality. The purpose is to be able to write values to a "writable" register which is not in the PPS input list. In this example, since RB pins are connected directly to ground and VDD in a pattern such that RB[15:0] = 23, I think it makes sense to do the following as qhb suggested: TRISB = 0xFFFF; RegX = PORTB; Circuit in Fig. 11-1 certainly clears everything. Take care. |
|
|
|
HILATB= ADC1BUF0;我认为这是16位的直接并行传输。TrISB= 0xMUN;LATB= ADC1BUF0;在我的系统上工作
以上来自于百度翻译 以下为原文 Hi LATB = ADC1BUF0; I think does a direct parallel transfer of the 16 bits. TRISB = 0x0000; LATB = ADC1BUF0; works on my system regards Tim |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1929 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3175 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2227 浏览 5 评论
736浏览 1评论
618浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
507浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
633浏览 0评论
530浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 02:10 , Processed in 1.785387 second(s), Total 103, Slave 86 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号