完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在尝试向计算机发送一个文本数组。我使用CP2102模块PIC18F47 K40、XC8 V1.44和RealMt1,数字1、2和7和8在计算机屏幕上显示,但是数组3456不显示。我做错什么了?
以上来自于百度翻译 以下为原文 Hello I am trying to send a array of text to the computer. I use a CP2102 module, Pic18F47K40 , XC8 v1.44 and Realterm The numbers 1,2 and 7 and 8 are displayd on the computer screen but the array 3456 not. What am I doing wrong? /* * Author: EP * programma bedoeld voor testboard met DIL_40 en PIC18F47K40 met de BME290 * Oled displayprint met leds en switch * Created on sept 2017 * BME280 displayen op Oled display en op de PC */ #include #include #include "global.h" #include "prototypes.h" #include "config_PIC18F47K40.h" #include "convert.h" int main(int) { OSCFRQ = 0b00000101; //16Mhz ANSELA = 0b00000000; //all digital LATA = 0b00000000; //clear LATA TRISA = 0b00000000; //PORTA output display A1=SDA ANSELB = 0b00000000; //all digital LATB = 0b00000000; //clear LATB TRISB = 0b11111000; //PORTB output display RB3_INT_input LATC = 0b00000000; //clear LATC TRISC = 0b11111111; //PORTC TRISD = 0b00000000; LATD = 0b00000000; ANSELE = 0b00000000; LATE = 0b00000000; //clear LATE TRISE = 0b11110000; RX1PPS = 0b00010111; //10 = PORTC 111 = pin7 RX1 TX1PPS = 0b00010110; //10 = PORTC 110 = pin6 TX1 RC6PPS = 0b00001001; //EUSART1 TX RC7PPS = 0b00001010; //EUSART1 RX TX1STAbits.TXEN = 1; //enable transmitting TX1STAbits.SYNC = 0; RC1STAbits.SPEN = 1; SP1BRGL = 25; //9600 bij 16MHz 24/26 werkt ook while(1) { TX1REG = 49; //1 while(!TX1STAbits.TRMT); TX1REG = 50; //2 while(!TX1STAbits.TRMT); unsigned char text[] = "3456"; for(n=0;n<4;n++) {karakter = text[n] ; TX1REG = karakter; while(!TX1STAbits.TRMT);} TX1REG = '7'; //7 while(!TX1STAbits.TRMT); TX1REG = '8'; //8 while(!TX1STAbits.TRMT); TX1REG = 0x0D; //new line while(!TX1STAbits.TRMT); __delay_ms(500); } } |
|
相关推荐
5个回答
|
|
有趣的是,但是目前“卡拉克特”的定义是不可见的,如果你把“2线”缩写成什么样子呢?
以上来自于百度翻译 以下为原文 Funny thing. But currently the definition of 'karakter' is invisible. And what happens if you abbreviate the "2-liner" to TX1REG = text[n];? |
|
|
|
K40 PICS在访问const数据方面有一个已知的问题。XC8的最新版本包含一个解决方案,但是您必须手动激活它。
以上来自于百度翻译 以下为原文 The K40 PICs have a known problem with accessing const data. The latest versions of XC8 contain a workaround for it, but you have to manually activate it. Have a look at http://www.microchip.com/forums/m969418.aspx |
|
|
|
感谢复制TX1RG=文本[n];不是解决方案
以上来自于百度翻译 以下为原文 thanks for replying TX1REG = text[n]; is not the solution |
|
|
|
|
|
|
|
问题是通过添加文件PoopUp来解决的。SooCube可以通过读取GHB(HTTP://www. McCys/Foals/M969418.ASPX)的答案来找到这个文件,谢谢您帮助MeEP。
以上来自于百度翻译 以下为原文 The problem is solved by adding the file powerup.as to the sourcefiles. You can find this file by reading the answer from ghb ( http://www.microchip.com/forums/m969418.aspx) Thanks for helping me ep |
|
|
|
只有小组成员才能发言,加入小组>>
5253 浏览 9 评论
2038 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3219 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2267 浏览 5 评论
792浏览 1评论
686浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
617浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
686浏览 0评论
586浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-30 07:20 , Processed in 1.400775 second(s), Total 85, Slave 69 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号