abdul991
Junior Member level 1
- Joined
- Feb 8, 2013
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,402
I'm trying to attach 2- .h files(delayy.h and ow.h) to the simp.c file
I'm getting one error please help
PIC samples\simple .h\ow.h:42:Warning [2066] type qualifier mismatch in assignment
PIC PIC samples\simple .h\ow.h:43:Warning [2058] call of function without prototype
PIC PIC samples\simple .h\ow.h:53:Error [1109] type mismatch in redeclaration of 'SerTxS'
This is my code
I'm getting one error please help
PIC samples\simple .h\ow.h:42:Warning [2066] type qualifier mismatch in assignment
PIC PIC samples\simple .h\ow.h:43:Warning [2058] call of function without prototype
PIC PIC samples\simple .h\ow.h:53:Error [1109] type mismatch in redeclaration of 'SerTxS'
This is my code
Code:
/*********simp.c FILE********************************************/
#include <P18F452.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "delayy.h"
#include "ow.h"
void main()
{
int r;
TXSTA = 0x20; // for asynchronous , tx enable settings
SPBRG = 18; // for 12mhz baud rate.
TXSTAbits.TXEN = 1;
RCSTAbits.SPEN = 1;
for(r=0;r<10000;r++);
while(1)
{
ow_reset();
for(r=0;r<10000;r++);
serialSendRst(ow_reset());
for(r=0;r<10000;r++);
}
}
/************************END***************************/
/**********************OW.H FILE*****************************/
#ifndef __OW_H
#define __OW_H
#ifndef __DS1820_H
#define __DS1820_H
#define OW_LAT LATBbits.LATB7
#define OW_PIN PORTBbits.RB7
#define OW_TRIS TRISBbits.TRISB7
#define LOW 0
#define HIGH 1
#include "delayy.h"
#include <string.h>
#include <stdio.h>
char str[40];
unsigned char ow_reset(void)
{
int device_found=0;
// DQ High
//OW_TRIS=HIGH;
// DQ Low
OW_LAT=0;
OW_TRIS=LOW;
// delay 480us
DS1820_DelayUs(98); // 480usec
// DQ High
OW_TRIS=HIGH;
// Wait for the sensors to respond
DS1820_DelayUs(13); // 60usec
// Determine is a device has responded
device_found = !OW_PIN;
return device_found;
}
void serialSendRst(unsigned char val)
{
sprintf(str,"device found = %1c",val);
SerTxS(str);
}
void SerTx(unsigned char c)
{
while(PIR1bits.TXIF == 0); //delay
TXREG = c; // 1 inst
}
void SerTxS(char* s)
{
int i;
for(i=0; i<strlen(s); i++)
SerTx(s[i]);
}
#endif
/****************** delayy.h FILE**************************/
#ifndef __DELAYY_H
#define __DELAYY_H
void DS1820_DelayUs(unsigned int delayUs)
{
int i;
for (i=0;i<delayUs;i++){}
}
#endif
/************************************/