完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我尝试使用打印,我从ProjtProjks:G.Simult:GuT,UART1IO启用。此外,我还包含了UART的PIC库。现在我在调试模式中使用PrtTf,但我没有得到任何东西,这里是我的主要文件:空main(空隙){StaseIn RealAlgIsIe();ErAtART1IX初始化();RC6=输出;/rx TrxCbTo.RC7=输入;//Rx ANSELCITSITS。ANSC6=数字;ANSELCITBES.ANSC7=数字;而(1){PrtTf(“a”);}
以上来自于百度翻译 以下为原文 I'm trying to use print, i checked from project properties->Simulator->Uart1 IO Enabled. Also i have include pic libraries for Uart. Now i'm using printf in debug mode but i dont get anything in console Here is My Main file: void main(void) |
|
相关推荐
16个回答
|
|
|
|
|
|
|
|
|
对不起,我忘了提了。XC8PIC18F45 K22。此外,我注意到在我的模拟器中写入这个消息W9602 COMP:DAC电压源外围设备尚未实现作为比较器的输入。
以上来自于百度翻译 以下为原文 Sorry i forgot to mention it. XC8 PIC18F45K22. Also i notice that in my simulator writes this message W9602-COMP:DAC Voltage Source Peripheral not yet implemented to act as input to Comparator. |
|
|
|
|
|
对于Prtff()在XC8中使用UART,必须编写自定义的PUCH()函数。这在XC8用户指南中被记录。
以上来自于百度翻译 以下为原文 For printf() to go to UART in XC8, you must write a custom putch() function. This is documented in the XC8 User Guide. Something like this: void putch(unsigned char dat) { while (PIR1bits.TX1IF); // wait until TXREG is ready TXREG1 = dat; } |
|
|
|
|
|
我认为这个错误是指它所说的。您正在尝试使用模拟器不支持的PIC的特性。
以上来自于百度翻译 以下为原文 I think the error means exactly what it says. You are trying to use a feature of that PIC not supported by the simulator. |
|
|
|
|
|
我收到了同样的信息。我是否应该尝试在物理设备中确保它有效?
以上来自于百度翻译 以下为原文 I'm getting same message. Should i try it in physical device for be sure that it works? |
|
|
|
|
|
当然是。串行输出工作与那个消息无关。如果这是你想要测试的,那么,是的,你需要在一个真正的设备上做。
以上来自于百度翻译 以下为原文 Of course you are. Getting serial output working has nothing to do with that message. If that is what you're trying to test, then yes, you need to do it on a real device. |
|
|
|
|
|
终于奏效了。它也与Prtff和PutCH一起工作。哪一个最合适使用?
以上来自于百度翻译 以下为原文 Finally it worked. It works also with printf and putch. Which is the most right for use? |
|
|
|
|
|
它向UART捕获输出。该例程将Putc-()输出发送到Eh UARTPrimTfF(),通过PutCh()发送所有输出(PoSts()也是如此,它比Prtff()开销少很多),如果要发送单个字符,则使用PutChar(),如果您想发送普通字符串,则使用PUTSH(或)(或CpScript())。结束格式化字符串,使用Primff()
以上来自于百度翻译 以下为原文 It is capturing output to the uart. That routine sends putc() output to eh uart printf() sends all output via putch() (so does puts(), which has a lot less overhead than printf() ) if you want to send single characters, use putch() If you want to send plain strings, use puts() or cputs() If you want to send formatted strings, use printf() |
|
|
|
|
|
也在PUCH中,如果我要发送Charcacter的B,我会得到“Th”。它只适用于如果我使用PrimTf。为什么要这样呢?
以上来自于百度翻译 以下为原文 Also in putch i dont get the characters right if i will send Charcacter 'B' i will get 'θ'. It only works if i will use printf. Why heppene this? |
|
|
|
|
|
请显示您用来调用PUCH()的确切代码。
以上来自于百度翻译 以下为原文 Please show the exact code you used to call putch() |
|
|
|
|
|
虚空EUARTAR1X初始化(空隙){//将EUSATAR1模块设置为用户界面中选择的选项。//ABDOVF NoA溢出;CKTXP AycCyNoFieldTySycLeFieldEdGE;BRG16 16BITH生成器;WUE禁用;AbDN禁用;DTRXP NOTION翻转;BUDCON1= 0x08;/SPEN启用;RX9 8位;CREN启用;0;StdB SycCuleBug完整;TXEN启用;同步异步;BRGH HySoad;CSRC SLaveYOME;TXSTA1= 0x24;//SPBRG1= 0xA0;//SPBRGH1= 0x01;} UIT88T EUARTAR1AULL(空隙){()!{RC1IF){}(1=rcSTAT1BIT.ORR){//EASARTAR1错误-RSTARTrcSTAT1BITS CREN=0;RCSTA1BITS CREN=1;}返回ECRARG1X写(UTITE81T TXDATA){(0=PIR1BIT.TX1IF){} TXRGE1= TXDATA;/ /写入数据字节到USART.} char GGCH(空隙){eUARTAR1A Read()返回;}无效PIL1BITPTCH(CHAR TXDATA){EUARTAR1X写(TXDATA);}
以上来自于百度翻译 以下为原文 void EUSART1_Initialize(void) { // Set the EUSART1 module to the options selected in the user interface. // ABDOVF no_overflow; CKTXP async_noninverted_sync_fallingedge; BRG16 16bit_generator; WUE disabled; ABDEN disabled; DTRXP not_inverted; BAUDCON1 = 0x08; // SPEN enabled; RX9 8-bit; CREN enabled; ADDEN disabled; SREN disabled; RCSTA1 = 0x90; // TX9 8-bit; TX9D 0; SENDB sync_break_complete; TXEN enabled; SYNC asynchronous; BRGH hi_speed; CSRC slave_mode; TXSTA1 = 0x24; // SPBRG1 = 0xA0; // SPBRGH1 = 0x01; } uint8_t EUSART1_Read(void) { while(!PIR1bits.RC1IF) { } if(1 == RCSTA1bits.OERR) { // EUSART1 error - restart RCSTA1bits.CREN = 0; RCSTA1bits.CREN = 1; } return RCREG1; } void EUSART1_Write(uint8_t txData) { while(0 == PIR1bits.TX1IF) { } TXREG1 = txData; // Write the data byte to the USART. } char getch(void) { return EUSART1_Read(); } void putch(char txData) { EUSART1_Write(txData); } |
|
|
|
|
|
你没有张贴我要的东西。我要求你调用PuCH()的代码,你在代码中从不这样做。
以上来自于百度翻译 以下为原文 You didn't post what I asked for. I asked for the code where you call putch(), which you never do in the code you posted. |
|
|
|
|
|
空主(空){StaseRealAlgRealIZE();EUTART1IILIALIALIZE();RC6=输出;//TXRISCISTITE。RC7=输入;//RXANSELCITS。ANSC6=数字;ANSELCSTATE。ANSC7=数字;同时(1){PutCH(“B”);}
以上来自于百度翻译 以下为原文 void main(void) { SYSTEM_Initialize(); EUSART1_Initialize(); TRISCbits.RC6=OUTPUT;//TX TRISCbits.RC7=INPUT;//RX ANSELCbits.ANSC6=DIGITAL; ANSELCbits.ANSC7=DIGITAL; while (1) { putch("B"); } } |
|
|
|
|
|
PcChh()为一个参数取一个字符。“B”不是一个字符,它是一个字符串,它在C.tryType中是完全不同的。使用的引号类型不同。如果您想打印一个字符串,请使用PUTSH(或)(或CpScript()),如我在帖子9中所说的。
以上来自于百度翻译 以下为原文 putch() takes a character for an argument. "B" is not a character, it is a string, which is something totally different in C. Try putch('B'); The type of quote you use makes all the difference. If you want to print a string, use puts() or cputs(), as I said back in post#9 |
|
|
|
|
|
谢谢您!它也能用于阅读吗?如果(GECHH()=‘B’){/ /我的代码的其余部分}
以上来自于百度翻译 以下为原文 Thank you! It will work also for read? if(getch()='B') { //Rest of my code } |
|
|
|
|
|
是的,但= =应该是= =,如果(GETCHE.()=='b')当你出错时,编译器应该警告你。
以上来自于百度翻译 以下为原文 Yes, but = should be == i.e. if(getch() == 'B') Your compiler should be warning you when you get this wrong. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
473 浏览 0 评论
5793 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1124浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1095浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 06:01 , Processed in 1.216855 second(s), Total 104, Slave 87 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1081