avov
Newbie level 3
- Joined
- Apr 30, 2013
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,315
extern void InitialiseLED(void);
extern void LED_Off(void);
extern void LED_On(void);
#include <p18cxxx.h>
void InitialiseLED(void)
{
TRISB = 0xF0; // In binary 0b1111000 four higher bits - input; four lower bits - output
}
void LED_Off(void)
{
PORTB&=(~0x01); //Turn LED0 off; first bitwise NOT (11111110); second bitwise AND (00000000 AND 11111110); result - 00000000
}
void LED_On(void)
{
PORTB|=0x01; // Turn LED0 on; bitwise OR need to add (00000000 OR 00000001); result - 00000001
}
#include <LED.h>
void main(void)
{
InitialiseLED();
LED_Off();
LED_On();
while(1){};// pause execution here
}
#ifdef __18F452
#include <p18cxxx.h>
#endif
void InitialiseLED(void)
{
TRISB = 0xF0; // In binary 0b1111000 four higher bits - input; four lower bits - output
}
void LED_Off(void)
{
PORTB&=(~0x01); //Turn LED0 off; first bitwise NOT (11111110); second bitwise AND (00000000 AND 11111110); result - 00000000
}
void LED_On(void)
{
PORTB|=0x01; // Turn LED0 on; bitwise OR need to add (00000000 OR 00000001); result - 00000001
}
:Error[1105] symbol 'TRISB' has not been defined
:Error [1101] lvalue required
LED.c is not included in the project. In main.c use #include "LED.c"
The function definitions are in LED.c file. If LCD.c file is not included then how will the functions work?
Code C - [expand] 1 2 3 4 5 6 #ifndef _MY_FUNC_H_ #define _MY_FUNC_H_ void myfunc(void); #endif
Code C - [expand] 1 2 3 4 5 6 #include <stdio.h> #include "myfunc.h" void myfunc(void) { printf("This is a sample function\n"); }
Code C - [expand] 1 2 3 4 5 6 #include <stdio.h> #include "myfunc.h" int main(void) { myfunc(); }
so if I understood your explanation, the OP forgot to include the led.h in his led.c file?
#include <LED.h>
void main(void)
{
InitialiseLED();
LED_Off();
LED_On();
while(1){};// pause execution here
}
#ifdef __18F452
#include <p18cxxx.h>
#elif _16F877A
#endif
#include <LED.h>
void InitialiseLED(void)
{
TRISB = 0xF0; // In binary 0b1111000 four higher bits - input; four lower bits - output
}
void LED_Off(void)
{
PORTB&=(~0x01); //Turn LED0 off; first bitwise NOT (11111110); second bitwise AND (00000000 AND 11111110); result - 00000000
}
void LED_On(void)
{
PORTB|=0x01; // Turn LED0 on; bitwise OR need to add (00000000 OR 00000001); result - 00000001
}
void InitialiseLED(void);
void LED_Off(void);
void LED_On(void);
#include <LED.h>
#include "LED.h"
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?