Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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++);
}
}
22942904903998539951.png
 

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++);
}
}
43621454201424966711.png
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top