| Author |
Message |
|
|
Posted: May 29, 2012 - 03:37 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
And plenty of free programmers available
The Xmega chips are NOT the same as other AVR/Mega chips.
The free/cheap programmers may program the AVR range but NOT the Xmegas as they use a different programming method. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 03:42 AM |
|

Joined: May 26, 2012
Posts: 15
|
|
Console aps. Easy..
Quote:
Got an app you want to try?
Didnt actually understood your question. Im using AVRStudio and GCC compiler. What you mean by app?
Having first problem. I saw in many examples that pins are assigned to be digital output or input by writing DDRC=0x00 or FF. it gives me a strange error.
Quote:
Error 1 'DDRC' undeclared (first use in this function)
Port C i digital. I actually tried other ports too but getting same error |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 03:47 AM |
|


Joined: Sep 04, 2002
Posts: 21267
Location: Orlando Florida
|
|
| Post the program. You need to select which AVR model number you are using. The compiler cant read your mind yet. Maybe next year. |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 03:49 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
Post your code.
Have you added #include <avr/io.h> so Studio knows which chip you are using? Have you set up the correct chip in the project? |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:01 AM |
|

Joined: May 26, 2012
Posts: 15
|
|
Hehe Mind reading compiler:P You dont even have to pres to keyboard in order to write.
Of course i did specified the deviece. You do it when creating a new project. And yes i have <avr/io.h>
Code:
#include <avr/io.h>
int main(void)
{
DDRQ=0xFF;
while(1)
{
PORTQ=0XFF;
}
}
|
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:06 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
Which chip are you using? Which version of AVRStudio?
You say that "'DDRC' undeclared" but you are using PORTQ. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:11 AM |
|

Joined: May 26, 2012
Posts: 15
|
|
AVRStudio6
ATXmega128A1U
I also mentioned that tried with other ports. That is the code for port Q. Same Error... |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:29 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
| Try
Code:
#include <avr/io.h>
int main(void)
{
PORTA_DIR=0xFF;
while(1)
{
PORTA_OUT=0XFF;
}
}
Unfortunately the version of Studio I have only supports the chip for assembly only, don't know about AS6. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:36 AM |
|

Joined: May 26, 2012
Posts: 15
|
|
Hmm strange.. And it works for me:) So i have Assembly instead of C ?
But when creating a new project i created a GCC C executable file.. how come? and i tried again to clear if mistakenly choose assembly. Same result.. DDR statement is not working for me:S |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:41 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
No you have C but winAvr20100110 which I use with Studio 4.18 doesn't support that chip yet.
So is it compiling now? |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:53 AM |
|

Joined: May 26, 2012
Posts: 15
|
|
it is compiling:) managed to write a simple led flasher.
Code:
#include <avr/io.h>
#include <avr/delay.h>
int main(void)
{
PORTA_DIR=1;
while(1)
{
PORTA_OUT=0;
_delay_ms(1000);
PORTA_OUT=1;
_delay_ms(1000);
}
return(1);
}
What should i do if codes in books are different the ones i use? |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 04:56 AM |
|


Joined: Mar 27, 2002
Posts: 18571
Location: Lund, Sweden
|
|
|
Quote:
Hmm strange.. [...] So i have Assembly instead of C ?
No, not strange at all.
You will actually have to open up the data sheet(s) for the AVR model you are working with to see which registers/ports it has, and what their names are.
On 8-bit (classic) AVRs there are registers registers with names like DDRx. On the 8/16-bit XMegas the digital IO-ports work differently and have other registers with other names, like PORTA_DIR. This is the difference, not if you are using assembler or C. Registers are the same in both languages. |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 05:03 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
Quote:
What should i do if codes in books are different the ones i use?
Choose books which are specific to the chip you are using??
Remember that Xmegas are NOT the standard AVR chip for which you may have the books for, now export that to the ARM field and you start to understand what I said before. http://www.avrfreaks.net/index.php?name ... 452#960452 |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 05:23 AM |
|

Joined: May 26, 2012
Posts: 15
|
|
@JohanEkdahl Thanks. That was very useful info. I actually found it in datasheet.
@js Aha im feeling it now:D
Then i have 2 options:
to find a book for my chip (which would be just perfect) or to try modifying code from other books for my chip working with datasheet (which is going to be a pain in some soft part of my body:P )
Luckily we have ASF examples. 255 ready and free examples for my chip:) that should be enough:) |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 08:58 PM |
|

Joined: May 26, 2012
Posts: 15
|
|
| im getting frustrated:S cant seem to find free open source programmer for Xmega. It turns out Xmegas are using relatively new PDI for programming. |
|
|
| |
|
|
|
|
|
Posted: May 29, 2012 - 11:22 PM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
|
|
|
|
|
Posted: May 29, 2012 - 11:49 PM |
|

Joined: May 26, 2012
Posts: 15
|
|
I knew you are going to point that
So what to do now? to move to ATmega? they are about 2 times more expensive than Xmega... Not cool:S
Or back to PIC18 Actually it turns out PICs are cheaper  |
|
|
| |
|
|
|
|
|
Posted: May 30, 2012 - 12:01 AM |
|


Joined: Mar 28, 2001
Posts: 20378
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
The Atmel AVR ISP Mk2 is not that expensive and you have a good tool supported by Atmel.
If you are part of a recognised learning institution you may try and get Atmel to help out, I think there is a university program.
Also you may want to look at the LUFA based programmer which you may be able to build yourself, we will need to wait on someone who has made one for further comments or wait for his excellence Dean to clarify some details.  |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: May 30, 2012 - 04:13 AM |
|


Joined: Dec 11, 2007
Posts: 6849
Location: Cleveland, OH
|
|
|
|
|
|
|
Posted: May 30, 2012 - 04:52 AM |
|


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA
|
|
This is a couple of posts above the post DocJC mentioned:
http://www.avrfreaks.net/index.php?name ... 137#960137
When it comes down to price it may be a toss up between the USBtiny and a real AVRISP mkii. I recommend one of these two for your needs.
This is what I built my AVRISP mkii clone with:
http://www.avrfreaks.net/index.php?name ... 124#957124
It is supposed to be able to do ISP, PDI, and TPI programming but I've only used it for ISP. The infrastructure for PDI and TPI is part of the LUFA code so it should work the same as a USBtiny. |
_________________ Larry
Those afraid to embrace the future will quickly fade into the past. - larryvc
|
| |
|
|
|
|
|