Hi!
I have a prototype board, with a pic16f877A microprocessor.
I have some demo assembly file, which I can compile and upload to the microprocessor, and it works!
The problem, that I cant write a really simple C program to blink a led.
It compiles succesfully, but when I upload to the device, nothing happens
Here is the sourcecode:
#include
/* ----------------------------------------------------------------------- */
/* Configuration bits: adapt to your setup and needs */
typedef unsigned int word;
word at 0x2007 CONFIG = _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _LVP_OFF & _CPD_OFF & _WRT_OFF & _DEBUG_OFF & _CP_OFF;
void init_board(void) {
TRISD0=0; // configure PORTD3 for input (pushbutton)
}
// ------------------------------------------------
// a simple delay function
void delay_ms(long ms)
{
long i;
while (ms--)
for (i=0; i < 330; i++)
;
}
void main() {
// sit in an endless loop blinking the led
for (;
{
RD0 = 0;
delay_ms(250);
RD0 = 1;
delay_ms(250);
}
}
--------------------------
Can somebody tell me, what is wrong here?
And an another question. I see in the reprap firmware,
that binary numbers have the following form:
INTCON = BIN(00000000); // Interrupts disabled
If I do the same, I have the following error message:
elso.c:11: warning 112: function 'BIN' implicit declaration
elso.c:11: error 101: too many parameters
Has anybody any idea why is that, and where the BIN function is defined?
Thank you in advance,
Best regards,
Khiraly