What is error in this?

Conference for discussion of Microchip's HI-TECH C Compilers.

What is error in this?

Postby LED » Sat Jul 28, 2018 1:55 pm

Hello
What is error in this code i am using hi tech c compiler
Code: Select all
#include <htc.h>

#define _XTAL_FREQ 2000000
void main()
{
  TRISB=0x00;
 
  while(1)
  {
    PORTB=0xf0;
 PORTB=0x0f;
__delay_ms(10);
}
}


HI-TECH PICC-Lite COMPILER (Microchip PICmicro) V9.50PL2
Copyright (C) 1984-2006 HI-TECH SOFTWARE
Error [499] ; . undefined symbol:
___delay_ms (INDIAA.obj)
LED
Banned
 
Posts: 40
Joined: Sat Jul 28, 2018 1:51 pm
PIC experience: EE Student

Re: What is error in this?

Postby vloki » Sat Jul 28, 2018 4:57 pm

Any reason to use old HI-TECH Lite compiler and not actual xc8?
vloki
Verified identity
 
Posts: 186
Joined: Wed May 28, 2014 8:42 am
Location: Germany
PIC experience: Professional 5+ years with MCHP products

Re: What is error in this?

Postby Jorgef » Sat Jul 28, 2018 8:53 pm

Hi

If the compiler doesn't recognise the "__delay_ms" symbol its a syntax error, assuming HTC has such a delay macro/function.
Check the manual to see the exact syntax for it.
Almost all PIC compilers I've seen have some form of "delay" macro, but they vary in details like the presence and number of underscores in the name.
Best regards
Jorge
Jorgef
Verified identity
 
Posts: 19
Joined: Wed May 30, 2018 8:46 pm
PIC experience: Professional 5+ years with MCHP products

Re: What is error in this?

Postby jtemples » Sun Jul 29, 2018 4:39 am

The older Hi-Tech compilers (including 9.50) do not have any built-in delay functions. You are trying to take something from XC8 and use it with Hi-Tech. There are some delay functions in the samples directory if you really must use Hi-Tech, but you should be using XC8.
jtemples
Verified identity
 
Posts: 195
Joined: Sun May 25, 2014 2:23 am
Location: The 805
PIC experience: Professional 5+ years with MCHP products

Re: What is error in this?

Postby ric » Mon Jul 30, 2018 3:44 am

FYI, I have just moved this topic from the "USB" forum to the "HI TECH C" forum.
LED, the copyright message is a hint that you are using an ancient compiler. "Copyright (C) 1984-2006 HI-TECH SOFTWARE"
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: What is error in this?

Postby Jorgef » Mon Jul 30, 2018 3:57 pm

Hi

PIC10/12/16 or PIC18?
Best regards
Jorge
Jorgef
Verified identity
 
Posts: 19
Joined: Wed May 30, 2018 8:46 pm
PIC experience: Professional 5+ years with MCHP products

Re: What is error in this?

Postby LED » Tue Jul 31, 2018 8:38 am

PIC16
LED
Banned
 
Posts: 40
Joined: Sat Jul 28, 2018 1:51 pm
PIC experience: EE Student

Re: What is error in this?

Postby ric » Tue Jul 31, 2018 11:39 am

LED, you've been asked several questions in this topic, and only answered one.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: What is error in this?

Postby Jorgef » Tue Jul 31, 2018 10:54 pm

Hi

Curious.
I have here an "Hitec C for PIC 10/12/16 users's guide" by Microchip (DS51865B from 2010) that clearly states the existence of "__delay_ms(x)", "__delay_us(x) as "macros" dependent on the definition of "_XTAL_FREQ", also a "_delay(unsigned long cycles)".
Compiler version is 9.83

The Hitec-C for PIC18, version 9.80 only has the last one (cycles).

Unfortunattley I don't have this toolchains configured in MPLAB so I can't make a test myself.

It might be dificult to find a newer version fo the HTC compiler, so I suggest you move to its direct descendant XC8.
Best regards
Jorge
Jorgef
Verified identity
 
Posts: 19
Joined: Wed May 30, 2018 8:46 pm
PIC experience: Professional 5+ years with MCHP products


Return to HI-TECH C

Who is online

Users browsing this forum: No registered users and 1 guest

cron