begineer to mplab c language need help .simple question.

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

begineer to mplab c language need help .simple question.

Postby sfchew7 » Sat Jun 04, 2011 8:18 pm

begineer to mplab c language need help .
I am trying to run this example but it failed.

This information is used by the compiler to link all the hardware specifics and
source programs together.
#include <16f877a.h>
#include <stdio.h>
#include <ctype.h>
#use rs232(baud=9600,xmit=PIN_B0,rcv=PIN_B1)
main()
{
printf(“Enter characters:”);
while(TRUE)
putc(toupper(getc()));
}

the error messages are " #use " and "printf" undefined.
Can anyone tells me what is the problem ? thanks
sfchew7
Greenhorn
 
Posts: 2
Joined: Sat Jun 04, 2011 7:59 pm

Re: begineer to mplab c language need help .simple question.

Postby Brian Griffin » Sat Jun 04, 2011 10:08 pm

sfchew7 WROTE:begineer to mplab c language need help .
I am trying to run this example but it failed.

This information is used by the compiler to link all the hardware specifics and
source programs together.
#include <16f877a.h>
#include <stdio.h>
#include <ctype.h>
#use rs232(baud=9600,xmit=PIN_B0,rcv=PIN_B1)
main()
{
printf(“Enter characters:”);
while(TRUE)
putc(toupper(getc()));
}

the error messages are " #use " and "printf" undefined.
Can anyone tells me what is the problem ? thanks


This code and its fragments are not from MPLAB C18 - it's the for the CCS compiler.

You will have to modify the code and read the libraries documentations for the MPLAB C18.
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Re: begineer to mplab c language need help .simple question.

Postby shahrul » Sun Jun 05, 2011 1:30 am

If use MPLab, just ignore this example and find another example that compatible with MPLab.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: begineer to mplab c language need help .simple question.

Postby robosang » Tue Jun 07, 2011 9:02 pm

Yup, if you use MPLAB, then try those compiler compatible with MPLAB such as HI-TECH, C18. Can CCS be integrated with MPLAB IDE?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: begineer to mplab c language need help .simple question.

Postby sfchew7 » Wed Jun 08, 2011 11:34 pm

oh.okay
then I would like to ask is it coding for CCS COMPILER AND HI-TECH are the same ?
thanks
sfchew7
Greenhorn
 
Posts: 2
Joined: Sat Jun 04, 2011 7:59 pm

Re: begineer to mplab c language need help .simple question.

Postby Brian Griffin » Thu Jun 09, 2011 12:42 pm

robosang WROTE:Yup, if you use MPLAB, then try those compiler compatible with MPLAB such as HI-TECH, C18. Can CCS be integrated with MPLAB IDE?


Yes, CCS can integrate with MPLAB IDE. They have command line interface for different IDE.

If you do not wish to purchase the CCS with IDE, the alternative will be the CLI version.

sfchew7 WROTE:oh.okay
then I would like to ask is it coding for CCS COMPILER AND HI-TECH are the same ?
thanks


The on-board functions and defines are not the same. You might need to modify them. Read the manuals of both compilers.
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am


Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 2 guests

cron