| Electronics > Projects, Designs, and Technical Stuff |
| Use for a (very) cheap or low spec microcontroller |
| << < (3/4) > >> |
| rhodges:
--- Quote from: romhunter on March 15, 2019, 04:10:19 pm ---Do you mind sharing your debounce function? I'd love to see your implementation (I never has a good software debounce experience before, it always bouncing around). --- End quote --- Here is the polling function from my 4x4 keypad library. The poll function is called every millisecond, but actual polling of 4ms and a 40ms debounce works well. --- Code: ---#define KP_DEBOUNCE 40 /* debounce count in milliseconds */ #define KP_KEY_REL /* notify when key is released (bit-7 set) */ #define KP_POLL_MS 4 /* actual key polling rate, milliseconds */ void keypad_poll(void) { char key; poll_count--; if (poll_count) return; /* no need to check every millisecond */ poll_count = KP_POLL_MS; key = check_key(); /* get key from current column, if any */ if (!key) { if (!bounce) /* key released? */ return; bounce--; if (bounce) /* not debounced yet */ return; #ifdef KP_KEY_REL add_key(curkey | 0x80); /* notify that key is released */ #endif curkey = 0; return; } reset_cols(); bounce = (KP_DEBOUNCE / KP_POLL_MS); if (curkey == key) /* key still pressed */ return; curkey = key; add_key(key); } --- End code --- |
| IDEngineer:
Think of them as "Reconfigurable glue circuitry so the inevitable Sales&Marketing-driven revisions can be prototyped, tested, and put into production in far less time, at far less cost, and without revving the PCB and schematic". ...or "A single, shared PCB and schematic that can be shared across multiple products to drive down the number of distinct SKU's, drive up volumes on that smaller number, and thus leverage economy of scale". |
| Warhawk:
I use the 10F322 in this project: http://panacek.net/post/magsw2a/ You can also compare it against the v10a version with a D-flipflop which is shown in a different artile on that very page. |
| mariush:
--- Quote from: Warhawk on March 15, 2019, 07:32:47 pm ---I use the 10F322 in this project: http://panacek.net/post/magsw2a/ You can also compare it against the v10a version with a D-flipflop which is shown in a different artile on that very page. --- End quote --- It's a bit off topic, but is there any particular reason you didn't use something like PIC10F320 (/2) or PIC12F1571 and just skip the 3.3v linear regulator altogether? The PIC12F1571 has 10bit ADC and you can set the internal voltage reference to 1.024v or 2.048v and runs with up to 5.5v and it seems that DRV5032 can also work with up to 5.5v And this chip has 256 bytes of SRAM and 128 bytes of 100k write flash, so you could probably also add a feature like log the last 50-100 measurements that are different (within +/- a few bits of tolerance) and when you push a button, the led could be used to flash the values (a basic led to 9600 baud serial or whatever adapter would be super cheap to make) |
| Warhawk:
--- Quote from: mariush on March 16, 2019, 12:33:04 am --- --- Quote from: Warhawk on March 15, 2019, 07:32:47 pm ---I use the 10F322 in this project: http://panacek.net/post/magsw2a/ You can also compare it against the v10a version with a D-flipflop which is shown in a different artile on that very page. --- End quote --- It's a bit off topic, but is there any particular reason you didn't use something like PIC10F320 (/2) or PIC12F1571 and just skip the 3.3v linear regulator altogether? The PIC12F1571 has 10bit ADC and you can set the internal voltage reference to 1.024v or 2.048v and runs with up to 5.5v and it seems that DRV5032 can also work with up to 5.5v And this chip has 256 bytes of SRAM and 128 bytes of 100k write flash, so you could probably also add a feature like log the last 50-100 measurements that are different (within +/- a few bits of tolerance) and when you push a button, the led could be used to flash the values (a basic led to 9600 baud serial or whatever adapter would be super cheap to make) --- End quote --- Good comment. The main reason for the LDO is that the input can go up to 18 V, Even the typical R/C system operates with voltages close to 6V when the receiver battery pack is fully charged. Also, more and more fiends have been using 2x LiFe battery. The second reason is that the internal voltage reference is incredibly inaccurate. I was surprised that Microchip specifies -8 + 6% tolerance for the 10F322 and +/-4 % for the 12F1571! This is rubbish. The LDO I am using is 1% tolerance output. I have always wanted to do something with the 10F family and this was the first project where it actually made sense. There is something special regarding the 6-pin microcontroller. 8) I also have a more adanced version with even current sensing and that one uses 12F1572 ::) |
| Navigation |
| Message Index |
| Next page |
| Previous page |