8、16 和 32 位微控制器编程有何区别?
我认为最大的区别在于数学函数的速度和优化,当然还有内部总线的大小,但是您能发布这些平台之间的更多差异吗?
I believe that the greatest difference is in speed and optimizations of math functions, and of course, the size of internal buses, but can you post more differences between these platforms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个复杂的问题。不同系列的微型计算机的功能各不相同。位数仅指数据管道的宽度,这限制了数学的精度,尽管许多微控制器要么模拟高阶数学,要么具有可以执行更高精度数学函数的特殊硬件。
历史性的差异在于价格:8 位最便宜,32 位昂贵。总体来说仍然如此,但 16 位部件的价格已大幅下降。
大多数 8 位处理器都很旧,并且在旧架构上运行,因此它们往往速度较慢。它们的制造成本也更低,因为这是 8 位点的竞争所在,这使得它们趋于缓慢。它们往往对支持的 RAM/其他存储也有较低的限制,但实际数量取决于系列。
16 位处理器往往也关注价格,但可用的部件种类繁多,其中一些具有相当高的性能和大量的片上外设。这些部件在精度大于 8 位的数学上通常比 8 位部件执行得更快,并且往往具有更多的可寻址内存。
32 位芯片的竞争主要在于应用程序的性能。有大量可用的 32 位部件,每个部件都针对某些特定应用。它们往往装载有外围设备,并在功能完整性上展开竞争。它们具有大量可寻址内存,并且性能往往优于 16 位部件。
This is a complicated question. Different families of micros vary in their capabilities. The number of bits just refers to the width of the data pipe, which limits the precision of math, although many micros will either emulate higher order math or have special HW that can perform higher precision math functions.
The historic difference has been price: 8-bit was cheapest, 32-bit was expensive. This is still true in generally, but the price of 16-bit parts have come down significantly.
Most 8-bit processors are old and run on old architectures, so they tend to be slower. They are also made more cheaply, since that is where the competition is at the 8-bit point, and this makes them tend towards slowness. They also tend to have a low limit on supported RAM/other storage, but the actual amount depends on the family.
16-bit processors tend to focus on price as well, but there is a large range of parts available, some of which have fairly high performance and large amounts of on-chip peripherals. These parts usually perform faster than 8-bit parts on math where the precision is greater than 8 bits, and tend to have more addressable memory.
32-bit chips compete primarily on performance for an application. There is a considerable range of 32-bit parts available, each targeted at some specific application. They tend to come loaded with peripherals and compete on feature completeness. They have a large amount of addressable memory and the performance tends to be better than 16-bit parts.
术语“8/16/32 位”可用于指代具有数据总线、地址总线、寄存器和指令集宽度的各种组合的设备;所以它本身就是一个糟糕的分类法。您必须比较特定设备及其关联的编译器才能得出具体结论。
从软件的角度来看,数据大小和地址范围是最明显的变化。例如,在 C 中,int 的大小可能会有所不同,并且在 8 位和 16 位编译器上通常为 16 位。
从根本上讲,8 位设备将需要更多数量的总线访问和更多指令来执行 16 或 32 位算术运算,因此可能会比其基本时钟速度慢一些。
虽然与架构宽度无关,但 16 位和 8 位设备不太可能包含 FPU 或 MMU,甚至高速缓存,而这些在 32 位设备中更为常见。
The term 8/16/32 bit may be used to refer to devices with various combinations of data bus, address bus, register and instruction set widths; so by itself it is a poor taxonomy. You have to compare specific devices and their associated compilers to draw any concrete conclusions.
From a software point of view, data sizes and address range are the most obvious variations. For example in C the sizeof an int may vary and is typically 16 bit on 8 and 16 bit compilers.
Fundamentally, an 8 bit device will require a greater number of bus accesses and more instructions to perform 16 or 32bit arithmetic operations so may be slower by more than its basic clock speed for that reason.
While not related to architecture width, 16 and 8 bit devices are unlikely to incorporate an FPU or MMU, or even cache memory whereas these are more common in 32bit devices.