vaka85
Advanced Member level 4
Hi all,
I've a very easy problem to solve (not easy for me).. But I'm a noob in pic programming and then I need help.
briefly: when there's a pulse in input, pic turn on a led in output.
Here is the code, I am using mikroC..
when I compile, there are a lot of errors, for example it doesn't recognize LATA and RA1...
maybe the problem is some missing file in "include" but I don't know.
any idea?
thanks
I've a very easy problem to solve (not easy for me).. But I'm a noob in pic programming and then I need help.
briefly: when there's a pulse in input, pic turn on a led in output.
Here is the code, I am using mikroC..
when I compile, there are a lot of errors, for example it doesn't recognize LATA and RA1...
maybe the problem is some missing file in "include" but I don't know.
Code:
#include "16F84.H"
#pragma config FOSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config PBADEN = OFF
void main(void) {
// set portA as inputs
LATA = 0x00;
TRISA = 0xFF;
// set portB as outputs
LATB = 0x00;
TRISB = 0x00;
while(1) // continually
{
// CLRWDT();
// EnablePullups(); // enable internal pullups on PORTB
if (RA1) // if there's a trigger pulse
{
RB0 = 1; // turn the LED on
for (j =0; j < 64000; j++) { //delay
}
RB0 = 0; // turn the LED off
for (j =0; j < 64000; j++) { //delay
}
}
}
}
any idea?
thanks