Example #1
0
int main(void) {
  int16_t i16_c;

  if (_POR) {
    i16_b = 0;
    _POR = 0;
  }
  configBasic(HELLO_MSG);

  outString("Hello world!\n");
  ++i16_a;
  ++i16_b;
  ++i16_c;
  printf("a = %d, b = %d, c = %d\n", i16_a, i16_b, i16_c);
  while (1) {
    // Do nothing.

    // After powering the chip on:
    //
    // - What is the value of a at this line? Either a number or x if
    //   unknown.
    // - What is the value of b at this line? Either a number or x if
    //   unknown.
    //
    // After pressing the MCLR button once:
    //
    // - What is the value of a at this line? Either a number or x if
    //   unknown.
    // - What is the value of b at this line? Either a number or x if
    //   unknown.
  }
}
Example #2
0
// I/O
// ===
int main(void) {
  configBasic(HELLO_MSG);
  CONFIG_RB14_AS_DIG_OUTPUT();
  CONFIG_RB13_AS_DIG_INPUT();
  ENABLE_RB13_PULLUP();

  while (1) {
  }
}
Example #3
0
int main(void) {
  configBasic(HELLO_MSG);
  _LATB15 = 0;

  // Initial value of RB15, at this line: 1, 0, X, Z.
  while (1) {
    DELAY_MS(250);
    _LATB15 = !_LATB15;
  }
}
Example #4
0
int main(void) {
  uint8_t u8_c;

  configBasic(HELLO_MSG);

  while (1) {
    u8_c = inChar();
    --u8_c;
    outChar(u8_c);
  }
}
Example #5
0
int main(void) {
  configBasic(HELLO_MSG);
  config_hb_led();
  HB_LED = 0;

  // Initial value of RB15, at this line: 1, 0, X, Z.
  while (1) {
    DELAY_MS(250);
    HB_LED = !HB_LED;
  }
}
Example #6
0
int main(void)
{
    uint16_t u16_count = 0;

    // Initialize.
    configBasic(HELLO_MSG);

    // After this, only ``B_main()`` can call ``createCoroutines``.
    CREATE_COROUTINES(ascocreate);

    // Main loop.
    while (1) {
        printf("Main: iteration %d.\n", u16_count++);
        gotoCoroutine(&scostate_A);
    }
}
Example #7
0
int main(void) {
  configBasic(HELLO_MSG);
  CONFIG_RB15_AS_DIG_OUTPUT();
  ENABLE_RB15_OPENDRAIN();
  _LATB15 = 0;  // Line A.

  // Initial value of RB15, at this line: 1, 0, X, Z.
  //
  // ALWAYS write to _LATxy, NOT _RBxy.
  while (1) {
    DELAY_MS(250);
    _LATB15 = !_LATB15;
  }
  // | #42: Value of RB15 at 100 ms: 1, 0, X, Z.
  // | #43: Value of RB15 at 300 ms: 1, 0, X, Z.
  // | #44: Period of the waveform, in ms?
}
int main (void) {
  uint16_t  u16_pot1;
  float   f_pot1;
  configBasic(HELLO_MSG);

  // make RA0/AN0/VREF+ a digital input to kill the pullup and
  // set the TRISA bit, then make it ANALOG so the ADC will work
  CONFIG_RB2_AS_ANALOG();
  while (1) {
    configADC1_ManualCH0(RB2_AN, 31, ADC_12BIT_FLAG );
    u16_pot1 = convertADC1();

    f_pot1 = 3.30 / ADC_NSTEPS * u16_pot1;

    printf("AN0 is 0x%0X or %1.4fV.\n",    \
           u16_pot1, (double) f_pot1);
    DELAY_MS(1500);

  } //endof while()
} // endof main()
int main(void)
{
 	 //configure pins. Only need SDO, SCLK since POT is output only
	CONFIG_RG8_AS_DIG_OUTPUT();   //use RF3 for SDO
	CONFIG_RG6_AS_DIG_OUTPUT();   //use RF6 for SCLK
 	CONFIG_RG7_AS_DIG_OUTPUT();   //use RF7 for SDI
	CONFIG_RF0_AS_DIG_OUTPUT();   //chip select for VDIP1_A
	CONFIG_RB9_AS_DIG_OUTPUT();   //chip select for VDIP1_B

    configBasic(HELLO_MSG);

	outString("Hello world \n");
	configHeartbeat();            //heartbeat LED



	//config SPI for VDIP1
	VDIP_Init();

	VDIP_WriteFile("BARBIE.TXT", "THREE IS THE MAGICAL NUMBER.  YOUR HUBBY LOVES YOU!");
	VDIP_WriteFile("ABCDEF1.TXT", "This is a test.");
	VDIP_WriteFile("ABCDEF2.TXT", "This is a test.");
	VDIP_WriteFile("ABCDEF3.TXT", "This is a test.");
	VDIP_WriteFile("ABCDEF4.TXT", "This is a test.");
	VDIP_WriteFile("ABCDEF5.TXT", "This is a test.");
	VDIP_WriteFile("ABCDEF.TXT", "This is a test-1.");
	VDIP_WriteFile("ABCDEF.TXT", "This is a test-2.");
	VDIP_WriteFile("ABCDEF.TXT", "This is a test-3.");	
	VDIP_WriteFile("ABCDEF.TXT", "This is a test-4.");





//	VDIP_ListDir();
	while(1){}
	return 0;
}
Example #10
0
int main(void) {
  int16_t i16_c;

  configBasic(HELLO_MSG);

  outString("Hello world!\n");
  ++i16_a;
  ++i16_b;
  ++i16_c;
  printf("a = %d, b = %d, c = %d\n", i16_a, i16_b, i16_c);
  while (1) {
    // Do nothing.

    // After powering the chip on:
    //
    // 46. What is the value of a at this line? Either a number or x if
    //     unknown.
    // #.  What is the value of b at this line? Either a number or x if
    //     unknown.
    // #.  What is the value of c at this line? Either a number or x if
    //     unknown.
  }
}