help me to find mistake in my program with keil for at91sam7s256

Status
Not open for further replies.

lonely boy

Newbie level 6
Joined
May 18, 2012
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
IRAN
Activity points
1,358
Hi
I written these codes for at91sam7s256 in keil compiler but the simulation it's not like the program that i want ! I want pulse but it's don't like this
and i don't know where is my mistake,Can any one help me to find it?
Best regards
Code:
#include <AT91SAM7S256.H>
int main (void) {
unsigned int n;
*AT91C_PIOA_PER= 0x80000 ; //set in PIO mode
*AT91C_PIOA_OER= 0x80000 ;// configure in output
while(1){
*AT91C_PIOA_SODR=0x80000 ;//PB.19 to be set
 for (n=0 ; n< 8000000;n++);
*AT91C_PIOA_CODR=0x80000 ; // PB.19 to be clear
 for (n=0 ; n< 8000000;n++);
}
}
 

The maximum value for a 16-bit unsigned int is 65535.
 
yes i forgot it , thanks
I chenge it but simulation cheng like this photo,i want 50% duty cycle
Code:
#include <AT91SAM7S256.H>
int main (void) {
unsigned int n;
*AT91C_PIOA_PER= 0x80000 ; //set in PIO mode
*AT91C_PIOA_OER= 0x80000 ;// configure in output
while(1){
*AT91C_PIOA_SODR=0x80000 ;//PB.19 to be set
 for (n=0 ; n<60000;n++);
*AT91C_PIOA_CODR=0x80000 ; // PB.19 to be clear
 for (n=0 ; n<60000;n++);
}
}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…