Timeline for Large array programming in PIC
Current License: CC BY-SA 4.0
25 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 21, 2022 at 5:05 | vote | accept | learn design | ||
| Aug 5, 2022 at 12:48 | answer | added | ScottishTapWater | timeline score: 2 | |
| Aug 5, 2022 at 8:37 | answer | added | Edgar Bonet | timeline score: 2 | |
| Aug 5, 2022 at 4:12 | comment | added | learn design | @spuck, I agree with you, it would be better with #define statement, but it is just a start point to discover sounds playing in PICs. | |
| Aug 4, 2022 at 23:59 | comment | added | spuck | Are you planning on the code choosing the note to play by specifying the index into the array? I think this might be a time when a header file with a set of #defines might be better. play_note(NOTE_D0); play_note(NOTE_A4) seems more coder-friendly than play_note(17); play_note(36); | |
| Aug 4, 2022 at 18:00 | history | tweeted | twitter.com/StackElectronix/status/1555252247675772929 | ||
| Aug 4, 2022 at 14:01 | comment | added | the busybee | Oh, and I did embedded development for 8-bitters for more than 30 years now, 8051, PIC, and so on. :-D I know what I'm talking about. | |
| Aug 4, 2022 at 13:57 | comment | added | the busybee | As I said, if the requirements permit, be as expressive and abstract as possible. All the reasons you name are good and well, and they apply if requirements could not be met otherwise. -- The time saved because future readers don't have to read potentially complex comments, to check that the transformations are right, and to grasp the code, outweighs any unnecessary optimization. -- Anyway, you need to have requirements! This is the core of any reasonable development, never work without. -- However, this point is not the issue of the question, and is subject of opinions. | |
| Aug 4, 2022 at 13:13 | history | became hot network question | |||
| Aug 4, 2022 at 12:58 | comment | added | brhans | @thebusybee - although I do agree with you in the general case, when you're writing code for a little slow MCU like the OP's 16F887 you need to be much more aware and accommodating of these issues right from the start. Choosing to use fix-point math here is not premature optimization - it's a sensible design choice. | |
| Aug 4, 2022 at 12:51 | history | edited | JRE | CC BY-SA 4.0 |
deleted 2 characters in body
|
| Aug 4, 2022 at 12:48 | answer | added | Justme | timeline score: 12 | |
| Aug 4, 2022 at 12:30 | history | edited | brhans | CC BY-SA 4.0 |
added 15 characters in body
|
| Aug 4, 2022 at 11:39 | comment | added | Neil_UK | Forget floats on a small MCU, use Ints | |
| Aug 4, 2022 at 10:51 | comment | added | TypeIA | @thebusybee No, avoiding "float" types is not a premature optimization when programming for an integer-only platform. This class of low-performance platform has tight requirements that can't usually be ignored the way they are in large scale (desktop, server, even mobile SoC) software development. | |
| Aug 4, 2022 at 10:40 | comment | added | user16324 | You might be better converting your code to use fixed point, which is much more efficient on small MCUs. | |
| Aug 4, 2022 at 8:59 | comment | added | the busybee | If memory and performance requirements allow, the software can calculate timer parameters from the floating point values. This array is perfectly abstract. As source code should make the programmer's intent clear for future readers, defining integer values for the timer would only be necessary if requirements are not met otherwise. Else I would call it premature optimization, which is worse maintainable. ;-) | |
| Aug 4, 2022 at 7:32 | comment | added | danmcb | I'm curious how these floats are going to be converted into frequencies anyway on a PIC. I'd have thought that having a timer controlled by a uint32_t or similar would be the way to go, in which case floats are not going to be helpful. | |
| Aug 4, 2022 at 7:26 | history | edited | ocrdu | CC BY-SA 4.0 |
deleted 6 characters in body; edited tags; edited title
|
| S Aug 4, 2022 at 6:33 | history | suggested | the busybee | CC BY-SA 4.0 |
Formatting
|
| Aug 4, 2022 at 5:26 | comment | added | TypeIA | Note that the PIC16F887, as well as many other chips in this class, lacks a floating-point unit (FPU). Consequently any floating point operations must be emulated by the compiler (if the compiler supports this), which is extremely slow. Use integer / "fixed-point" techniques instead wherever possible. | |
| Aug 4, 2022 at 5:24 | answer | added | the busybee | timeline score: 16 | |
| Aug 4, 2022 at 5:14 | review | Suggested edits | |||
| S Aug 4, 2022 at 6:33 | |||||
| Aug 4, 2022 at 5:13 | comment | added | the busybee |
What does your consultation of your compiler's documentation reveal, how to store constant data in flash memory? You might need the keyword const and perhaps some compiler specific "hint" in the source code.
|
|
| Aug 4, 2022 at 5:07 | history | asked | learn design | CC BY-SA 4.0 |