Society of Robots - Robot Forum

Software => Software => Topic started by: nckspec on March 31, 2008, 01:56:52 AM

Title: very confused
Post by: nckspec on March 31, 2008, 01:56:52 AM
hello, ive bee looking into the $5o robot code and ive heard that you have to specify the abilities of the microcontroller at the beginning. I don't understand. Do you have to program each microcontroller differently in c or could i use a tutorial for a pic controller with avr atmega8
Title: Re: very confused
Post by: Tsukubadaisei on March 31, 2008, 04:54:43 AM
hello, ive bee looking into the $5o robot code and ive heard that you have to specify the abilities of the microcontroller at the beginning. I don't understand. Do you have to program each microcontroller differently in c or could i use a tutorial for a pic controller with avr atmega8

Yes, different microcontroller brands(like pic, atmega or sh) need different codes because their compilers and definitions are very different. The standard C is the same but the address numbers are different and the tags attached to those addresses(through #define) are usually different. With controllers from the same brand(like atmega 88 or atmega 32) sometimes the code can be very simiar(if not the same). So ADMIN's code for the $50 robot will not work on a PIC(he uses an atmega, I think).
Title: Re: very confused
Post by: superchiku on March 31, 2008, 06:20:54 AM
YOUR ANSWER IS THE LOGIC IS ALWAYS THE SAME,

ITS THE DECLARATION AND SYNTAX THAT DIFFERS , IN PIC THE REGISTER ADRESSES AND NAMES ARE DIFFERENT BUT THE LOGIC WILL ALWAYS BE THE SAME ... SO YES THE ADMIN'S LOGIC "NOT THE COMPLETE CODE" WILL WORK WITH PIC
Title: Re: very confused
Post by: nckspec on March 31, 2008, 03:04:11 PM
Ok so the loops and all of that stuff in c will work with any controller but when you are controlling the ports its different
Title: Re: very confused
Post by: nckspec on March 31, 2008, 03:07:38 PM
also how would i know what i need to change when programming a different controller
Title: Re: very confused
Post by: superchiku on March 31, 2008, 03:37:09 PM
well friend for that u need to learn a little abt embedded c and which registers to access in the type of microcontroller ur using
Title: Re: very confused
Post by: nckspec on March 31, 2008, 04:59:25 PM
Also what out of the $50 robot code do you need if you were starting from scratch on a different robot. I want to understand the basic structure of the code so I can build on it for different projects.
Title: Re: very confused
Post by: superchiku on March 31, 2008, 10:22:03 PM
if u want to understand the code then have a thorough reading of the complete codes and header files, the more clear u are abt the code the better will be ur understanding abt the subject..
Title: Re: very confused
Post by: nckspec on April 01, 2008, 01:54:46 AM
Thank you so much, i read through the $50 robot code and stampy code and now i understand a lot. And I was about to spend $40 on an online tutorial to learn this stuff.