Adapting Code for the 1-Key Keyboard
Posted: Mon Apr 04, 2011 7:07 pm
I have basic experience with the Atmega series of microcontrollers(simple IO, timers, interrupts, PWM) and wanted to try this project out:
http://blog.flipwork.nl/?x=entry:entry081009-142605
I wanted(for experimental and learning purposes) to use this code on an Atmega32 instead of the Attiny85 suggested in the blog.
Please tell me what I should look out for while editing and compiling the code.
Here is a list of things that I think need to be changed in the source code so that it will work:
1. In usbconfig.h, I changed the code to:
Anything else in usbconfig.h?
2.In main.c
which is just setting the prescaler at CK/1024, so I thought I could do the same with TCCR1B= 5; // to set CS12 and CS10 (clk/1024)
for the Atmega32
3. My Atmega32's fuse bits have already been set for high frequency external crystal and I have both a 16Mhz and 12Mhz crystal. (I read that I can use either?)
Are there any other things I should be careful of while changing the code ?
Thank you.
http://blog.flipwork.nl/?x=entry:entry081009-142605
I wanted(for experimental and learning purposes) to use this code on an Atmega32 instead of the Attiny85 suggested in the blog.
Please tell me what I should look out for while editing and compiling the code.
Here is a list of things that I think need to be changed in the source code so that it will work:
1. In usbconfig.h, I changed the code to:
Code: Select all
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 2 //because INT0 on the mega32 is PinD2
Anything else in usbconfig.h?
2.In main.c
Code: Select all
static void timerInit(void)
{
TCCR1 = 0x0b; /* select clock: 16.5M/1k -> overflow rate = 16.5M/256k = 62.94 Hz */
}
which is just setting the prescaler at CK/1024, so I thought I could do the same with TCCR1B= 5; // to set CS12 and CS10 (clk/1024)
for the Atmega32
3. My Atmega32's fuse bits have already been set for high frequency external crystal and I have both a 16Mhz and 12Mhz crystal. (I read that I can use either?)
Are there any other things I should be careful of while changing the code ?
Thank you.