What am I doing wrong?

Status
Not open for further replies.

Micro82

New Member
#include <p18f4455.h>
#pragma config WDT = OFF

#define B0 0;

void delay (void)
{
int i;
for (i = 0; i < 10000; i++);
}

void main(void)
{
while (1)
{
output_high(PORTB_RB0);
delay();
output_low(PORTB_RB0);
delay();
}
}

// All I want to do s toggle RB0 with a small delay. keep getting the following error.

Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\MCC18\bin\mcc18.exe" -p=18F4455 /i"C:\MCC18\h" "main.c" -fo="main.o" -mL -Oa -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.02 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 58
C:\Pics\main.c:16:Error [1105] symbol 'PORTB_RB0' has not been defined
C:\Pics\main.c:16:Warning [2058] call of function without prototype
C:\Pics\main.c:18:Error [1105] symbol 'PORTB_RB0' has not been defined
C:\Pics\main.c:18:Warning [2058] call of function without prototype
Halting build on first failure as requested.
BUILD FAILED: Sat Aug 05 21:48:11 2006

// I have checked and made sure that PORTB & RB0 are definded but still get the error. I'm new to C programming. Any ideas would be great.
 
I'm just learning C18 so I might not be much help. Still, I'm curious, are output_high and output_low library functions? I can't find them. And how did you come up the the PORTB_RB0 construct? I've only learned how to toggle bits so far using something like this;

Code:
    PORTBbits.RB0 = 1;
 
Thanks Mike

As I stated before I'm also very new to C programming aswell.

I managed to get it to go using the code;

PORTBbits.RB0 = 0;

Regards

Pete
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…