Jump to content

Ywiz

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Ywiz

  • Rank
    Newbrie
  1. Thanks, it worked! I was using the 16F84 by the way... /Ywiz
  2. How do you get mpasm to assemble in c2c? I guess you have to do something else than just get the program... I only get errors when I try to assemble from c2c and have to start mpasm "manually" to get it right. /Ywiz
  3. No It isn't the watchdog, I've disabled that. What I mean when I say nothing happens is that the delay "dissapears". The rest of the application works just fine. What I'm trying to accomplice is to tunr a diode (RB2) on for a second with the push of a button (RB0). The diode is turned on but as soon as the button is released the diode is turned off. I've tried to make it blink by using a delay but then it's lit or turned off (depending on how i set it up) all the time. Here is my complete code: asm __config _LP_OSC & _WDT_OFF & _PWRTE_ON & CP_OFF #pragma CLOCK_FREQ 4000000 void main( void ) { set_bit( STATUS, RP0 ); //Select the Register bank 1 set_tris_a( 0x00 ); //Configure the Port A set_tris_b( 0x01 ); //Configure the Port B OPTION_REG = 199; //Configure the OPTION register clear_bit( STATUS, RP0 ); //Select the Register bank 0 INTCON = 160; //Configure the INTCON register while(1) { if(input_pin_port_b(0)) { output_low_port_b(2); } else { output_high_port_b(2); delay_s(2); } } } /Johan
  4. Does anyone know why i can't get delays to work in c2c? My code looks like: if(input_pin_port_b(0)) { output_low_port_b(2); } else { output_high_port_b(2); delay_s(2); } but the delay seems to be ignored... What should I do to make it work? /Johan
×
×
  • Create New...