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 in PIC programming during "mydata==a" is running

Status
Not open for further replies.

xanseviera

Junior Member level 3
Joined
Jun 22, 2010
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,434
Code:
   do{

      if(kbhit())
      {mydata=getch();
         mystat=1;}

      if(mystat==1)
      {

      if(mydata=='a' || mydata=='A') // Junction 1
      {
      //green at junction 1
      output_high(PIN_D5);
      output_low(PIN_D6);
      output_low(PIN_D7);
      
      output_low(PIN_E2); //<--- how to terminate this during execution of mydata=='a'
      }

      mystat=0;
   }

     else if (mystat==0)
     {
     //junction 1
     if(input(PIN_E2)==0)
      {
      //green
      output_high(PIN_D5);
      output_low(PIN_D6);
      output_low(PIN_D7);
      junction2();
      delay_ms(2000);
      //yellow
      output_high(PIN_D6);
      output_low(PIN_D7);
      output_low(PIN_D5);
      delay_ms(2000);
      //red
      output_high(PIN_D7);
      output_low(PIN_D6);
      }
}
while(1);


guys,

my problem is... when 'mydata=='a'' is running, at the same time PIN_E2 have an input, PIN_E2 will execute the task.
i need help in my programming, during 'mydata=='a'' is running, i want to make sure that PIN_E2 didn't work even it has an input.
but PIN_E2 can work outside 'if statement'.
 

Re: PIC programming

do you knw any prgramming language rather than "break" - "return" - "exit sub"?
 

Re: PIC programming

hello,
can i know how to interface PIC 16f877a with matlab?
thnk u..
 

    V

    Points: 2
    Helpful Answer Positive Rating
Re: PIC programming

can i know how to interface PIC 16f877a with matlab?

U could hook up the uc to the PC using serial port. Depends on the level of control u require.
 
  • Like
Reactions: zueyan

    zueyan

    Points: 2
    Helpful Answer Positive Rating
Re: PIC programming

actually im using lptop..not pc..after hook up my uc to my lptop..what should i do??i mean do u guys have example of programming to run my dc motor using matlab?thank you..
 

Re: PIC programming

you are using PIN_E2 as input or output ?
 

Re: PIC programming

is it PIN_E2 is PWM?i used port B as my output..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top