Reply by Microbit_P43000 October 3, 20082008-10-03
That really does look extremely simple :-)

Best Regards,
Kris
________________________________________
From: A... [mailto:A...] On Behalf Of
Tony Brenke
Sent: Friday, 3 October 2008 12:55 PM
To: A...
Subject: {Disarmed} Re: [AT91SAM] Re: need help to work with ARM
at91sam7x256

simple PWM led using Rowley

// This program shows how to work whit SPI interface and
// connected to it multimedia card
// Programs read/write buffer to MMC card
#define __inline inline
#include
#include
#include "board.h"
#include "system.h"
#include
#include "avrage.h"
#include "usart.h"
#include "adc.h"
#include
#include

#pragma data_alignment=4

//MAIN POINTER
AT91PS_PIO m_pPio = AT91C_BASE_PIOA;

//local SUB
void set_directionl(char val);
void set_directionr(char val);


//global var
unsigned char outstr[80];
unsigned char counter;
unsigned int adcval;
float V;

#define TWI_BUS_CLOCK 400000 /* in Hz*/

/* value of the PIT value to have 333ns @ 48 MHz
668 -1 since real time out = PIV + 1 */
#define PIT_PIV_MILI_SECOND_VALUE 0x667

/* value of the PIT value to have 333ns @ 48 MHz
3 -1 since real time out = PIV + 1 */
#define PIT_PIV_MICRO_SECOND_VALUE 0x2


int main()
{
int counter=0;
int ret;
int state;

// System init
InitFrec();

//setup IO
InitPeriphery();

// START PWM setup
AT91F_PWM_CfgPMC();// enable clock
AT91F_PWM_CH0_CfgPIO();
AT91F_PWM_CH1_CfgPIO();

AT91F_PIO_CfgOutput(P23);//disable PWM
AT91F_PIO_CfgOutput(P11);//disable PWM
AT91F_PIO_CfgOutput(P24);//disable PWM
AT91F_PIO_CfgOutput(P12);//disable PWM

AT91F_PIO_CfgOutput(P7);//direction lines Left
AT91F_PIO_CfgOutput(P2);//direction lines Right


AT91F_PWM_CfgChannel(AT91C_PWMC_CHID0, (int)(10|1<<8), 100, 50);
AT91F_PWM_CfgChannel(AT91C_PWMC_CHID1, (int)(10|1<<8), 100, 50);

AT91F_PWM_StartChannel(AT91C_PWMC_CHID0);
AT91F_PWM_StartChannel(AT91C_PWMC_CHID1);

// end PWM setup




// setup adc
InitADC();

// setup usart0
// InitUSART0(115200);
// setup usart1
InitUSART1(115200);

// setup RTS Interupt for COM0
init_PIO_interupt();

// config TWI
AT91F_TWI_Open(TWI_BUS_CLOCK);

counter= AT91F_WDTGetPeriod(30);
AT91F_WDTSetMode ( AT91C_WDTC_WDRSTEN | AT91C_WDTC_WDRPROC|counter);
AT91F_WDTC_CfgPMC();




AT91F_PIO_CfgOutput(P12);
AT91F_PIO_ClearOutput(P12);

AT91F_PIO_CfgOutput(P31);
AT91F_PIO_SetOutput(P31);
AT91F_PIO_ClearOutput(P31);
AT91F_PIO_SetOutput(P31);
__enable_interrupt();
printf("Start 1\r");


printf("end\r");
set_directionl(0);
set_directionr(0);

set_directionl(1);
set_directionr(1);

counter =0;
wait_m(150);

while(1){
AT91F_WDTRestart();
counter++;
AT91F_PWM_UpdateChannel(AT91C_PWMC_CHID0,counter);
printf("Counter %u\r",counter);
AT91F_PIO_SetOutput(P31);
AT91F_PWM_UpdateChannel(AT91C_PWMC_CHID1,500);

wait_m(250);
AT91F_PIO_ClearOutput(P31);
AT91F_PWM_UpdateChannel(AT91C_PWMC_CHID1,0);
wait_m(250);

}
}



void set_directionl(char val){
if(val==1){
AT91F_PIO_SetOutput(P7);
}
else{
AT91F_PIO_ClearOutput(P7);
}
};

void set_directionr(char val){
if(val==1){
AT91F_PIO_SetOutput(P2);
}
else{
AT91F_PIO_ClearOutput(P2);
}
};





----- Original Message -----
From: nixxterlid
To: A...
Sent: Thursday, October 02, 2008 10:20 AM
Subject: [AT91SAM] Re: need help to work with ARM at91sam7x256

i really desperate trying right now. n i'm totally stuck..
i dont know what should i know now..
i've tried to follow each step on the rowley crosswork but i came out of
nothing at all..
can anyone give me a real SIMPLE CODING (for example displaying hello
message), with appropriate SIMULATOR..i've tried to search everywhere but my
worst i couldn't find any..

________________________________________

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.173 / Virus Database: 270.7.5/1702 - Release Date: 10/1/2008
9:05 AM

Reply by Jerry West October 3, 20082008-10-03
The Keil IDE has example programs for the AT91SAM7S256. That was the basis for the instrument development I implemented. There are several examples provided.

Jerry

From: A... [mailto:A...] On Behalf Of nixxterlid
Sent: Thursday, October 02, 2008 12:21 PM
To: A...
Subject: [AT91SAM] Re: need help to work with ARM at91sam7x256

i really desperate trying right now. n i'm totally stuck..
i dont know what should i know now..
i've tried to follow each step on the rowley crosswork but i came out of nothing at all..
can anyone give me a real SIMPLE CODING (for example displaying hello message), with appropriate SIMULATOR..i've tried to search everywhere but my worst i couldn't find any..
Reply by Tony Brenke October 2, 20082008-10-02
simple PWM led using Rowley

// This program shows how to work whit SPI interface and
// connected to it multimedia card
// Programs read/write buffer to MMC card
#define __inline inline
#include
#include
#include "board.h"
#include "system.h"
#include
#include "avrage.h"
#include "usart.h"
#include "adc.h"
#include
#include

#pragma data_alignment=4

//MAIN POINTER
AT91PS_PIO m_pPio = AT91C_BASE_PIOA;

//local SUB
void set_directionl(char val);
void set_directionr(char val);
//global var
unsigned char outstr[80];
unsigned char counter;
unsigned int adcval;
float V;

#define TWI_BUS_CLOCK 400000 /* in Hz*/

/* value of the PIT value to have 333ns @ 48 MHz
668 -1 since real time out = PIV + 1 */
#define PIT_PIV_MILI_SECOND_VALUE 0x667

/* value of the PIT value to have 333ns @ 48 MHz
3 -1 since real time out = PIV + 1 */
#define PIT_PIV_MICRO_SECOND_VALUE 0x2
int main()
{
int counter=0;
int ret;
int state;

// System init
InitFrec();

//setup IO
InitPeriphery();

// START PWM setup
AT91F_PWM_CfgPMC();// enable clock
AT91F_PWM_CH0_CfgPIO();
AT91F_PWM_CH1_CfgPIO();

AT91F_PIO_CfgOutput(P23);//disable PWM
AT91F_PIO_CfgOutput(P11);//disable PWM
AT91F_PIO_CfgOutput(P24);//disable PWM
AT91F_PIO_CfgOutput(P12);//disable PWM

AT91F_PIO_CfgOutput(P7);//direction lines Left
AT91F_PIO_CfgOutput(P2);//direction lines Right
AT91F_PWM_CfgChannel(AT91C_PWMC_CHID0, (int)(10|1<<8), 100, 50);
AT91F_PWM_CfgChannel(AT91C_PWMC_CHID1, (int)(10|1<<8), 100, 50);

AT91F_PWM_StartChannel(AT91C_PWMC_CHID0);
AT91F_PWM_StartChannel(AT91C_PWMC_CHID1);

// end PWM setup

// setup adc
InitADC();

// setup usart0
// InitUSART0(115200);
// setup usart1
InitUSART1(115200);

// setup RTS Interupt for COM0
init_PIO_interupt();

// config TWI
AT91F_TWI_Open(TWI_BUS_CLOCK);

counter= AT91F_WDTGetPeriod(30);
AT91F_WDTSetMode ( AT91C_WDTC_WDRSTEN | AT91C_WDTC_WDRPROC|counter);
AT91F_WDTC_CfgPMC();

AT91F_PIO_CfgOutput(P12);
AT91F_PIO_ClearOutput(P12);

AT91F_PIO_CfgOutput(P31);
AT91F_PIO_SetOutput(P31);
AT91F_PIO_ClearOutput(P31);
AT91F_PIO_SetOutput(P31);
__enable_interrupt();
printf("Start 1\r");
printf("end\r");
set_directionl(0);
set_directionr(0);

set_directionl(1);
set_directionr(1);

counter =0;
wait_m(150);

while(1){
AT91F_WDTRestart();
counter++;
AT91F_PWM_UpdateChannel(AT91C_PWMC_CHID0,counter);
printf("Counter %u\r",counter);
AT91F_PIO_SetOutput(P31);
AT91F_PWM_UpdateChannel(AT91C_PWMC_CHID1,500);

wait_m(250);
AT91F_PIO_ClearOutput(P31);
AT91F_PWM_UpdateChannel(AT91C_PWMC_CHID1,0);
wait_m(250);

}
}

void set_directionl(char val){
if(val==1){
AT91F_PIO_SetOutput(P7);
}
else{
AT91F_PIO_ClearOutput(P7);
}
};

void set_directionr(char val){
if(val==1){
AT91F_PIO_SetOutput(P2);
}
else{
AT91F_PIO_ClearOutput(P2);
}
};

----- Original Message -----
From: nixxterlid
To: A...
Sent: Thursday, October 02, 2008 10:20 AM
Subject: [AT91SAM] Re: need help to work with ARM at91sam7x256
i really desperate trying right now. n i'm totally stuck..
i dont know what should i know now..
i've tried to follow each step on the rowley crosswork but i came out of nothing at all..
can anyone give me a real SIMPLE CODING (for example displaying hello message), with appropriate SIMULATOR..i've tried to search everywhere but my worst i couldn't find any..

------

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.173 / Virus Database: 270.7.5/1702 - Release Date: 10/1/2008 9:05 AM
Reply by Charles Manning October 2, 20082008-10-02
Have a look at the Lejos project
http://lejos.svn.sourceforge.net/viewvc/lejos/trunk/nxtvm/platform/nxt/
This is code for the Lebo Mindstorms NXT... an At91SAM7S256
On Friday 03 October 2008 05:20:57 nixxterlid wrote:
> i really desperate trying right now. n i'm totally stuck..
> i dont know what should i know now..
> i've tried to follow each step on the rowley crosswork but i came out of
> nothing at all.. can anyone give me a real SIMPLE CODING (for example
> displaying hello message), with appropriate SIMULATOR..i've tried to search
> everywhere but my worst i couldn't find any..

Reply by Paul Curtis October 2, 20082008-10-02
From: A... [mailto:A...] On Behalf Of nixxterlid
Sent: 02 October 2008 18:21
To: A...
Subject: [AT91SAM] Re: need help to work with ARM at91sam7x256

i really desperate trying right now. n i'm totally stuck..
i dont know what should i know now..
i've tried to follow each step on the rowley crosswork but i came out of nothing at all..
can anyone give me a real SIMPLE CODING (for example displaying hello message), with appropriate SIMULATOR..i've tried to search everywhere but my worst i couldn't find any..

Perhaps if you had registered for an evaluation with your own e-mail address, somebody might have been more interested in helping.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
Reply by nixxterlid October 2, 20082008-10-02
i really desperate trying right now. n i'm totally stuck..
i dont know what should i know now..
i've tried to follow each step on the rowley crosswork but i came out of nothing at all..
can anyone give me a real SIMPLE CODING (for example displaying hello message), with appropriate SIMULATOR..i've tried to search everywhere but my worst i couldn't find any..
Reply by Nicolae Constantinescu September 24, 20082008-09-24
I used this for a low cost, quick start and it worked absolutely outstanding !
Download the zip-ed package and read the pdf which gives step by step instructions. It works!
http://www.at91.com/Tool/Controleurs/cVisualisation.php?idVisualisation!2
Reply by "FreeRTOS.org Info" September 24, 20082008-09-24
> As a student, IAR is a little expensive to play with.

The recommended limited (KickStart) version is free and allows code to be
built up to 32KByte (I think from memory).

You cannot get any less expensive than that ;o)

Regards,
Richard.

+ http://www.FreeRTOS.org
17 official architecture ports, more than 6000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.

Reply by Eric Haver September 24, 20082008-09-24
Hi nixxterlid,

As a student, IAR is a little expensive to play with.

First, check out http://www.yagarto.de/
Secondly, look into http://www.ethernut.de/en/software/index.html

for a great RealTimeOperatingSystem (RTOS).

*Eric
On Wed, Sep 24, 2008 at 10:35 AM, nixxterlid wrote:

> i'm totally new to this and i need to do my final year project using
> it. can anyone give any simple example source code and it's
> appropriate compiler, editor and simulator? i've tried to learn the
> rowley associates crosswork version 1.7 but i'm still clueless about
> it n how to use it. please help..really in need
>
>
>
Reply by "FreeRTOS.org Info" September 24, 20082008-09-24
> -----Original Message-----
> From: A...
> [mailto:A...] On Behalf Of nixxterlid
> Sent: 24 September 2008 15:35
> To: A...
> Subject: [AT91SAM] need help to work with ARM at91sam7x256
>
> i'm totally new to this and i need to do my final year
> project using it. can anyone give any simple example source
> code and it's appropriate compiler, editor and simulator?
> i've tried to learn the rowley associates crosswork version
> 1.7 but i'm still clueless about it n how to use it. please
> help..really in need
>
CrossWorks is one of the simpler IDE's to use. Also look at getting one of
the free limited versions of IAR. You best bet is to look at the example
projects that come with these tools. Look in the installation directory.
That way you start with something that is ready to go and pre-configured for
your target hardware. Much easier that trying to start from a blank project
Regards,
Richard.

+ http://www.FreeRTOS.org
17 official architecture ports, more than 6000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.