完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在MPLAB和XC8IT中,用户如何不再支持ScFFAMILYDO FFET,仍然有效吗?如果不是,我的选择是什么?我正在让用户输入一个浮标。
以上来自于百度翻译 以下为原文 How does one go about taking user input in MPLAB and XC8 it no longer support the scanf family does fgets, still work? if not what are my options here i am getting user to input a float |
|
相关推荐
12个回答
|
|
输入如何?在XC8中没有标准的输入设备。一旦有了要在字符串中转换的字符,就可以使用ATOF()将其转换成浮点变量。
以上来自于百度翻译 以下为原文 Input how? There are no standard input devices in XC8. Once you have the characters to be converted in a string, you can use atof() to convert it to a float variable. |
|
|
|
这是我想输入的
以上来自于百度翻译 以下为原文 float radiusOfSphere,radiusOfCyclinder,heightOfCyclinder,valueAlongAxis1,valueAlongAxis2,valueAlongAxis3; printf("nCalculate Volume of spheren"); printf("Enter radius: "); scanf("%f",&radiusOfSphere); printf("Volume of Sphere is %f", volumeSphere(radiusOfSphere)); printf("nCalculate Volume of Cylindern"); printf("Enter radius: "); scanf("%f",&radiusOfCyclinder); printf("Enter height: "); scanf("%f",&heightOfCyclinder); printf("Volume of Sphere is %f", volumeCylinder(radiusOfCyclinder,heightOfCyclinder)); printf("nCalculate Volume of Ellipsoidn"); printf("Enter value along axis 1: "); scanf("%f",&valueAlongAxis1); printf("Enter value along axis 2: "); scanf("%f",&valueAlongAxis2); printf("Enter value along axis 3:"); scanf("%f",&valueAlongAxis3); printf("Volume of the ellipsoid is %f", volumeEllipsoid(valueAlongAxis1,valueAlongAxis2,valueAlongAxis3)); return 0; this was i want to take input of |
|
|
|
我似乎无法理解如何使用用户输入,我从来没有见过任何种类的XC8
以上来自于百度翻译 以下为原文 i can't seem to understand how to take user input i have never seen anything of the sort with xc8 |
|
|
|
你能理解你的代码是在PIC上运行的,而不是在PC上运行的?你打算如何在PIC中进出数据?通过串口?
以上来自于百度翻译 以下为原文 You do understand that your code is running on the PIC, not the PC? How are you planning on getting the data in and out of the PIC? Via a serial port? |
|
|
|
是的,我理解,所以我一直想在代码块中做所需要的问题。我想在代码块中提供解决方案+ MPLAB中的一个代码,在这里我初始化变量。
以上来自于百度翻译 以下为原文 Yes I do understand hence i have been tempting to do the required question in codeblocks. I am thinking of providing solution in codeblock code + a code in mplab where i initiliaze my variables |
|
|
|
这听起来好像是在编写一个在PC上运行的代码,而不是在PIC上运行。如果这是一个类任务,你实际上需要做什么?如果要编写在PIC上运行的代码,那么试图避免在嵌入式系统上运行的问题是避免分配的整个要点。
以上来自于百度翻译 以下为原文 It sounds like you're trying to write code to run on a PC, not in a PIC at all. If this is a class assignment, what are you actually required to do? If it's to write code that would run on a PIC, then trying to avoid the issues of running on an embedded system is avoiding the whole point of the assignment. |
|
|
|
这是一个课堂作业。问题就在这里。我们只被告知在类中使用MPLAB和XC8,所以我不确定我的教授在哪里使用这个创建库(即A.H报头和.c源文件),计算三个几何形状的体积:球体、右(未压缩)圆柱体和椭球(查找它!)用户在调用函数时,提供适当的参数,如小数形式的球面半径。你的函数返回卷。所有的公式都使用了;在源代码中使用了一个y*定义语句,用4.0*ATAN(1)替换了ππ。在定义的名称中使用下划线来避免不必要的替换;例如,您不希望PIE成为4 *AATN(1)E。请确保您命名函数和变量以增强可读性。如果你在源代码中有MIN(或),或者Prtff(),你就不会做我要做的事情。
以上来自于百度翻译 以下为原文 It is a class assignment. Here is the question. we are only told to use MPlAB and xc8 in class so i am not sure where my prof is going with this Create a library (i.e. a .h header and .c source file) that calculates volume of three geometric shapes: the sphere, the right (untilted) cylinder, and the ellipsoid (look it up!). The user supplies the appropriate parameter such as radius for the sphere in decimal form when calling the function. Your function returns the volume. All the formulas use ; use a #define statement in the source code to replace _PI_ with 4.0*ATAN(1.0). Underscores in defined names are used to avoid unwanted substitutions; you wouldn’t want PIE to become 4.0*ATAN(1.0)E for example. Make sure you name the functions and variables to enhance readability. Add comments for clarity. If you have main() or printf() in your source code you are not doing what I am asking. |
|
|
|
这个问题似乎很清楚,你显然没有仔细阅读过。
以上来自于百度翻译 以下为原文 The question seems clear enough, and you plainly have not read it carefully. |
|
|
|
我开始相信用户并不意味着我认为它意味着什么。它是指我作为一个用户?我现在明白了,我现在走的是正确的道路吗?
以上来自于百度翻译 以下为原文 i have come to believe user doesn't mean what i think it means. it is refering to me as a user ? i have this now, am i now on the right path ? #include #include #include"calculateVolume.h" // library with prototyoes #include"configureUSART.h" int main(void) { // initialize all variables float radiusOfSphere=2.0,radiusOfCyclinder=2.0,heightOfCyclinder=2.0; float valueAlongAxis1=2.0,valueAlongAxis2=2.0,valueAlongAxis3=2.0; float volume_Of_Sphere,volume_Of_Cyclinder,volume_Of_Ellipsoid; //volume_Of_Sphere=volumeOfSphere(radiusOfSphere); volume_Of_Cyclinder=(radiusOfCyclinder,heightOfCyclinder); volume_Of_Ellipsoid=(valueAlongAxis1,valueAlongAxis2,valueAlongAxis3); return 0; } /* float volumeOfSphere(float radiusOfSphere) { float volume=volumeSphere(radiusOfSphere); return volume; } */ float volumeOfCyclinder(float radiusOfCyclinder, float heightOfCyclinder) { float volume=volumeCylinder(radiusOfCyclinder,heightOfCyclinder); return volume; } float volumeOfEllipsoid (float valueAlongAxis1,float valueAlongAxis2, float valueAlongAxis3) { float volume=volumeEllipsoid(valueAlongAxis1,valueAlongAxis2,valueAlongAxis3); return volume; } |
|
|
|
这句话这么难懂吗?要求不是提供一个完整的程序,只是一个函数库。
以上来自于百度翻译 以下为原文 Is this statement so hard to understand? The requirement is NOT to supply a complete program, just a library of functions. |
|
|
|
你显然不明白这个说法:想想看。函数的用户如何向函数提供参数。你知道怎么写C函数吗?C函数如何返回一个值。当然不是使用Prtff。不要来这里期待课堂上交给你的课堂作业的答案。
以上来自于百度翻译 以下为原文 You clearly do not understand this statement: Think about it. How does the user of your function supply the parameters to the function. Do you know how to write a C function? And How does a C function return a value. certainly NOT by using printf. Don't come here expecting the answers to class assignments to be handed to you on plate. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
596浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 01:30 , Processed in 1.571475 second(s), Total 99, Slave 83 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号