完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
HII没有Tx线EASART PIC18F45 K40的数据,因此我在TX线上没有任何数据。我在示波器和扫描逻辑中检查它和结果是相同的:在TX线路中没有数据没有信号。从我的经验与其他设备,我知道TX线应该是高的,即使没有传输TX。检查焊料O做了:和线TX和RX的行为与源指令相同。所以焊锡是好的。你能帮我告诉我为什么会这样吗?特别是为什么他们在TX没有数据?
以上来自于百度翻译 以下为原文 Hi I haven't Data in Tx line EUSART PIC18F45k40. /* * File: main.c */ #include // CONFIG1L #pragma config FEXTOSC = HS // External Oscillator mode Selection bits (HS (crystal oscillator) above 8 MHz; PFM set to high power) #pragma config RSTOSC = EXTOSC // Power-up default value for COSC bits (EXTOSC operating per FEXTOSC bits (device manufacturing default)) // CONFIG1H #pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled) #pragma config CSWEN = ON // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed) #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)*/ void Delay(unsigned int delay) { while(delay){ delay--; } } void main(void) { OSCCON2bits.COSC0=1; // external oscillator OSCCON2bits.COSC1=1; OSCCON2bits.COSC2=1; ANSELC = 0; // AS DIGITAL // LATC = 0; // ? TRISC = 0x80; //rc7 input rc6 output (RX,TX)) WPUC = 0xC0; // pull up Tx RX ANSELA = 0; // set led as output TRISA =0; LATA = 0; TRISAbits.TRISA0 = 0; // Led 1 TRISAbits.TRISA1 = 0; // Led2 TRISAbits.TRISA2 = 0;// Led3 TRISAbits.TRISA3 = 0;// Led 4 PMD4bits.UART1MD=0; //EUSART1 MODULE ENABLED SP1BRGL=19; // 12mhz for 9600 // Tx register TX1STAbits.TXEN=1; TX1STAbits.SYNC=1; TX1STAbits.BRGH=0; TX1STAbits.CSRC =1; //Rx register RC1STAbits.SPEN=1; RC1STAbits.CREN=0; RC1STAbits.SREN=0; //Enable Receiver (RX) */ BAUD1CONbits.BRG16=0; MDSRCbits.SRCS0 = 1 ; //EUSART1 TX/CK as output MDSRCbits.SRCS1 = 0; MDSRCbits.SRCS2 = 0; MDSRCbits.SRCS3 = 1; while(1) { LATAbits.LATA0 = 1; LATAbits.LATA1 = 1; LATAbits.LATA2 = 0; LATAbits.LATA3 = 0; while(TX1STAbits.TRMT == 0 ) { } TX1REG = 123; // smoething data } return; } In result I don't have any data on Tx line. I check it in oscilloscop and in scan logic and result are the same: No data no signal in Tx line. From my experience with another devices I know Tx line should be high even if there are no transmition Tx.For checking solder o done that: while(1){ TRISC = 0x00; LATCbits.LATC7 = 1; LATCbits.LATC6 = 1; LATCbits.LATC6 = 0; LATCbits.LATC6 = 1; LATCbits.LATC7 = 0;} And line Tx and Rx behave the same as in source instruction. So solder is OK. Could You help and tell me why it behave that? And especially why they no data in TX line? |
|
相关推荐
2个回答
|
|
我添加了RC6PPS= 0B01001;一些东西出现在TX线。
以上来自于百度翻译 以下为原文 I added RC6PPS = 0b01001; and something appeared in tx line. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5244 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3214 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2261 浏览 5 评论
779浏览 1评论
673浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
599浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
683浏览 0评论
580浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 17:53 , Processed in 1.371000 second(s), Total 78, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号