I've looked a little over the datasheet for the 328P MCU. It's ok for the design. The only problem I see is the low memory (2K SRAM) that will not allow a very big commutation table to be allocated. (The table storing the commutation shift for each encoder step). This being said the circuit will only allow lets say 1024PPR max encoders, or if bigger used, a precision decimation is needed. Or we could drop the commutation table, and use in realtime calculation of the commutation, sacrificing in performance...
Thus being said, what we would need is:
1. at least 2 external interupts
2. at least 16K of Flash
3. at least 2K of RAM
4. at least 6 PWM outputs (it would be nice to have them all 16 bit)
5. at least 1 ADC input
6. hardware UART is nice but not really a must
7. lowest price.
ATMEGA 328 has all of these... I could try and modify the design and code for it but it would be later this year, in autumn I hope...
Mihai
PS: I just discovered that int 1 is shared with a PWM Output (PCINT19/OC2B/INT1) PD3... This is not so good for our design, We will have to use a PCINT for the second interupt = performance issues...
Hello.
From what I know so far ATMega1284 has 2 counters on 16 bit so a very little code modification is requred (I think) for PWM initliazition. That should be all. I also have a few of those and I might give it a try.
Mihai
PS. 1284 has also a great bunch of SRAM(16K) so further code optimizations I think are also possible.
PS. Code is fully compliant with 1284. 1284 has another counter (OCR3) that is on 16 bit but it's not used. (all you have to do is open the project and change MCU type and then hit compile)
Hi Mihai am very interest with your project that you share, please i don't have a big experience with Mikropascal can you help me how to change the mcu 644p to 1284p to compile it, because i have a AC servo motor 3 phase 2500ppr 8 poles...
Thank very much
Stewart