Greetings and salutations fellow humans! I was wondering if someone was willing to help me understand what I need to do to adapt code written to work for ATMega 128 to work with a newer ATMega328 Duemilanove. Is the language universal? Do I need to change lines including things like PB to PORTB or am I way off? I have posted similar topics with not a single response so I am looking to reword my query in a way that might elicit some help. I am new at all of this and I could use a little guidance at times.
There are errors including the PB items as well as PC and PD.
any help would be awesome!
Thanks in advance.
Check here http://www.avr-developers.com/
I think the 128 is listed. This looks like a great chip, with real 8-bit ports!
That could be a problem, trying to go to the 328 which has less real hardware to work with.
Thanks for the reply! I however might have bitten off more than I can chew. I got a new music shield as a gift and can't get it to work because (me thinks) the "demo" code was written for an older Arduino. I can only find one person suggesting something like changing the portpins.h file, but I don't know.
Looks like the shield was made for that then. Playback only mode (since you don't have a MEGA with the 1280 processor).
What is the issue? Folks can help you get it running. Is outside of my experience field tho.
Thanks. At this point no playback even. I am only looking for basic functions now but would like to take advantage of the ipod hookup for power and i/o to the micro sd. It looks as though I will keep at it and consider the mega recording in the future. Do you have any idea why the supplied code won't even compile in the Arduino software. Possibly the non 1280 processor or is it a conflict with the language? By the way thanks for the help. As I said I started 3 other posts that went without response and although I still haven't got this thing working I thank you for your time. I still would like to know if anyone out there has had luck with this piece. Thanks!
As I said I am totally new to this and I am a little lost but thanks for input!
config.cpp: In function 'void InitSPI()':
config.cpp:31: error: 'PB4' was not declared in this scope
config.cpp:32: error: 'PB3' was not declared in this scope
config.cpp:33: error: 'PB5' was not declared in this scope
config.cpp:37: error: 'PB2' was not declared in this scope
config.cpp: In function 'void InitIOForVs10xx()':
config.cpp:64: error: 'PC1' was not declared in this scope
config.cpp:65: error: 'PC2' was not declared in this scope
config.cpp:66: error: 'PC3' was not declared in this scope
config.cpp:67: error: 'PC0' was not declared in this scope
config.cpp: In function 'void InitIOForKeys()':
config.cpp:89: error: 'PD7' was not declared in this scope
config.cpp:90: error: 'PD6' was not declared in this scope
config.cpp:91: error: 'PD5' was not declared in this scope
config.cpp:92: error: 'PD3' was not declared in this scope
config.cpp:93: error: 'PD4' was not declared in this scope
config.cpp: In function 'void InitIOForLEDs()':
config.cpp:102: error: 'PB1' was not declared in this scope
config.cpp:103: error: 'PB0' was not declared in this scope
Looking at your error messages, you have identified the port naming differences etc as the issue. I haven't looked in detail at the differences between the processors, but if the ATmega128 is more feature packed than the 328 (as indicated by CrossRoads), you may have to reallocate which ports are used for what. If the code you are trying to run is a well developed application, this may be worth it but if you are just running the example code, I would go for the 328 specific examples in the link above.
I was only looking for a code to play music on this item. The use of the ipod dock would have been pretty cool too. I have tried that link too and won't compile. I will keep looking for good code for my board until I can get another type of arduino to try it on. It seems I am just a little behind the curve as this thing not new anymore and so no buzz. Also nobody I actually know does anything with electronics or programming, so the www is my only source. Thanks anyway...
OK, so I downloaded the MusicShieldNewSDLib.zip, and managed to get it to compile successfully for the Duemilenove (ATmega 328). I encountered two issues: I had to download the Fat16Lib package and install it into the libraries directory under the local sketchbook directory (as requested in the comments at the top of the pde file). In my case, the sketchbook directory is at /home/paul/sketchbook, and I created a subdirectory called libraries. I unzipped the Fat16Lib package there - it creates a Fat16 sub directory with the library source code. The second issue was related to case sensitivity. The Fat16util.h file is referenced in three or four places, but with a capital 'U': Fat16Util.h. I changed the source code in each file as required, making the capital 'U' a lower case 'u'.
I don't have your shield so I can't load it and see if it works - perhaps you can give it a go?
I didn't change any of the code, with the exception of the header file change as detailed above. I am using arduino 0021, and unzipped the file into a sub-directory by itself. Have you set the right board in the Tools menu? Selecting the wrong board would give you problems!
Yes I have selected the right board. I cannot get the code to compile even. Without connecting the board to USB. those error messages still appear. If I tell the software I have a mega w/ 1280, it compiles. I however do not have a mega with 1280 I have duemilanove w/ 328. Are the pin #'s the conflict? Are there different pin definitions from board to board? Can I change the pin #'s in the code to get it to play nice with my board or am I SOL until I get a Mega w/ 1280? Can I change a header in the code to "remind " it that I have another arduino?