Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 4th July 2009, 01:49 PM   #16
Default thanks very much

thanks for all for help me
this is the last code i write
Code:
void main(){
  char oldstate = 0;
  int x;
  TRISB = 0xFF;          // set PORTB to be input
  TRISD = 0;             // set PORTD to be output
  PORTD = 0x0F;          // initialize PORTD

  do {
    if (Button(&PORTB, 1, 1, 1))                // detect logical one on RB1 pin
      oldstate = 1;
    if (oldstate && Button(&PORTB, 1, 1, 0)) { 
                                                // detect one-to-zerotransition on RB1 pin
       for(x=0;x,1000;x++)
{
//code of my project
PORTd=0;
Delay_us(337);
PORTd=0B00000101;
Delay_us(2717);
PORTd=0B00001001;
delay_us(3889);
PORTd=0B00000101;
delay_us(2667);
PORTd=0;
delay_us(777);
PORTd=0B00000110;
delay_us(2667);
PORTd=0B00001010;
delay_us(3889);
PORTd=0B00000110;
delay_us(2667);
PORTd=0;
delay_us(388);
}


       // negates value on PORTD
      oldstate = 0;
    }
  } while(1);         // endless loop
  }
and when i press on the nswitch connected to pin RB1 the program run
iam very happy and thanks for all one try to help me
but was the error is that i was connect the switch to port A instead of port B
or what is the wrong in all the previous codes
thanks alot for all
girgis adly is offline  
Reply

Tags
micro, programming

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
pic programming by micro C girgis adly Micro Controllers 4 28th April 2009 02:37 PM
pic micro programming in C fusian Micro Controllers 8 18th February 2008 06:11 PM
programming of AT89c51 micro-controller nivvy Micro Controllers 7 4th December 2005 05:57 AM
micro C OS mithilaa Micro Controllers 0 21st January 2005 06:58 AM
MICRO herbymcduff Datasheet/Parts Requests 3 20th December 2002 05:16 PM



All times are GMT. The time now is 01:49 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker