Question

#include <p18f4580.h> #include <stdio.h> #define mybit PORTBbits.RB1 void Timer1_Delay() {    T1CON = 0;    TMR1H...

#include <p18f4580.h>
#include <stdio.h>
#define mybit PORTBbits.RB1

void Timer1_Delay()
{
   T1CON = 0;
   TMR1H = 0xFC;
   TMR1L = 0x18;
   T1CONbits.TMR1ON = 1;

wait:
   if (PIR1bits.TMR1IF == 0)
   { goto wait;}
   else
   { T1CONbits.TMR1ON = 0;
       PIR1bits.TMR1IF = 0;}
}

void main (void)
{    TRISB = 0;
   ADCON1 = 0x7F;
  
   while(1)
   {
       mybit- ~mybit;
       Timer1_Delay();
    }
}

E:\Retry\main.c:27:Warning [2058] call of function without prototype

Keep getting the following error in MPLab, can't seem to find a way around. Any recommendations would be greatly appreciated!

Homework Answers

Answer #1

Actually it's the habit of MPLab to throw warning #2058 when you call the function that takes no parameters even if the function prototype is declared just add the void keyword in function arguments and the problem will be solved like this:

void Timer1_Delay(void)
{
   T1CON = 0;
   TMR1H = 0xFC;
   TMR1L = 0x18;
   T1CONbits.TMR1ON = 1;

wait:
   if (PIR1bits.TMR1IF == 0)
   { goto wait;}
   else
   { T1CONbits.TMR1ON = 0;
       PIR1bits.TMR1IF = 0;}
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is output? #include <stdio.h> void CheckValue(int* pointVar1, int* pointVar2) {       if (pointVar1 == NULL...
What is output? #include <stdio.h> void CheckValue(int* pointVar1, int* pointVar2) {       if (pointVar1 == NULL && pointVar2 == NULL) {       printf("Pointer is null\n");    }    else if (*pointVar2 > *pointVar1) {       printf("%p\n", *pointVar2);    }    else if (*pointVar1 > *pointVar2) {       printf("%p\n", *pointVar1);    } } int main() {    int num1 = 5;    int num2 = 9;       CheckValue(&num1, &num2);           return 0; } a. 0 b. 5 c. 9 d. Pointer is null e....
Please explain what will be printed out at LINE1 and LINE2? #include <stdio.h> #include <types.h> int...
Please explain what will be printed out at LINE1 and LINE2? #include <stdio.h> #include <types.h> int data[4] = {1,3,5,7}; void *runner (void *param); int main(int argc,char *argv[]) { pid_t pid; pthread_t tid; pid = fork(); if (pid==0){ pthread_create(&tid,NULL,runner,NULL); pthread_join(tid,NULL); for(int i=0,i<4,i++) printf("from child process, the values at i is %d",data[i]); } else if (pid>0){ wait(NULL); for(int i=0;i<4,i++) printf("from parent process, the values at i is %d",data[i]); } } void *runner(void *param){ for(int i=0;i<4,i++) data[i]+=3*i; pthread_exit(0); } } } } }
#include <stdio.h> #define K   1024 /** (2pts) * Make a program that reads a line of...
#include <stdio.h> #define K   1024 /** (2pts) * Make a program that reads a line of input (up to 1024 characters, using * fgets,) and scans the input for the lowercase letter 'x'. If it finds an x, * it should print "The string has an x in it.\n" and exit, if it does not, it * should print "The string did not have an x in it.\n", then exit. You may * not use any standard library functions other...
why's is my csis.txt saving ? #include <stdio.h> FILE*fp; void calculateBMI(void); int main(void) {    fp...
why's is my csis.txt saving ? #include <stdio.h> FILE*fp; void calculateBMI(void); int main(void) {    fp = fopen("csis.txt", "w"); for (int i= 0; i<4; ++i){ calculateBMI(); } fclose(fp); return 0; } void calculateBMI(void){ double weight,height,bmi;    printf("Enetr your weight in pounds:\n\n"); fprintf(fp,"Enter your weight in pounds:\n\n"); scanf("%lf",&weight); printf("Enter height in inches:\n\n"); fprintf(fp,"Enter height in inches:\n\n"); scanf("%lf",&height); bmi=(703*weight)/(height*height);    if (bmi<18.5){ printf("You have a BMI of %.lf, and your weight status is underweight\n",bmi);    fprintf(fp,"You have a BMI of %.lf, and...
#include <stdio.h> #define K   1024 /** (2pts) * Copy the string in src to dst. Only...
#include <stdio.h> #define K   1024 /** (2pts) * Copy the string in src to dst. Only copy as many characters (including the * null character) that are in src to dst. Points will be deducted for copying * too many or too few characters. */ void my_strcpy(char dst[], char src[]) { } int main(void) { char input[K+1], copy[K+1]; // Get a line of input (up to K number of bytes) into the 'input' string: // Do not modify any of...
0001 #include <stdio.h> 0002 0003 #define NUM_PRODUCTS 2 0004 #define NUM_CATEGORIES 2 0005 #define NUM_DIGITS 2...
0001 #include <stdio.h> 0002 0003 #define NUM_PRODUCTS 2 0004 #define NUM_CATEGORIES 2 0005 #define NUM_DIGITS 2 0006 0007 struct ProductInfo 0008 { 0009     int prodID; 0010     int numberInStock; 0011     double unitPrice; 0012 }; 0013 0014 int main(void) 0015 { 0016     struct ProductInfo productList[NUM_PRODUCTS] = 0017     { 0018         {78, 8, 19.95}, 0019         {95, 14, 22.98} 0020     }; 0021 0022     int categoryCount[NUM_CATEGORIES] = { 0 }; 0023 0024     int i,...
Using the C programming language implement Heapsort in the manner described in class. Here is some...
Using the C programming language implement Heapsort in the manner described in class. Here is some example code to use as a guideline. Remember, you need only implement the sort algorithm, both the comparison and main functions have been provided. /* * * after splitting this file into the five source files: * * srt.h, main.c, srtbubb.c, srtinsr.c, srtmerg.c * * compile using the command: * * gcc -std=c99 -DRAND -DPRNT -DTYPE=(float | double) -D(BUBB | HEAP | INSR |...
C CODE PLZ! All instructions are in sections of code #include <stdio.h> /* TODO: Define 3...
C CODE PLZ! All instructions are in sections of code #include <stdio.h> /* TODO: Define 3 functions input, gcd and lcm in such a way that the main function below compiles correctly and has the correct behavior. The input function prompts the user to enter a non-negative integer. If the user enters a negative integer, the function prints a "sorry" statement and prompts the user again. It keeps on prompting until the user enters a non-negative number. The input function...
#include <stdio.h> #pragma warning(disable : 4996) // CSE 240 Fall 2016 Homework 2 Question 3 (25...
#include <stdio.h> #pragma warning(disable : 4996) // CSE 240 Fall 2016 Homework 2 Question 3 (25 points) // Note: You may notice some warnings for variables when you compile in GCC, that is okay. #define macro_1(x) ((x > 0) ? x : 0) #define macro_2(a, b) (3*a - 3*b*b + 4*a * b - a*b * 10) int function_1(int a, int b) { return (3*a - 3*b*b + 4*a * b - a*b * 10); } // Part 1: //...
In this lab, you will write a program that creates a binary search tree based on...
In this lab, you will write a program that creates a binary search tree based on user input. Then, the user will indicate what order to print the values in. **Please write in C code** Start with the bst.h and bst.c base code provided to you. You will need to modify the source and header file to complete this lab. bst.h: #ifndef BST_H #define BST_H typedef struct BSTNode { int value; struct BSTNode* left; struct BSTNode* right; } BSTNode; BSTNode*...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT