CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Serial communication

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Labiran, Simeon Olusola
Guest







Serial communication
PostPosted: Wed Jul 27, 2005 6:12 am     Reply with quote

Dear Young,
I compiled a programme to enable my PIC 18F452 communicate with PC through RS232. The Programme failed to build and the error result is :
" function used but not defined : set_timer_2 "
On line 8, i defined this function. What could have wrong withthis programme? Please, i need your advice.
My programme is as follow:


#include <18F452.h>
#include <stdio.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use fixed_io(C_outputs=pin_C6)
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12

//#include <loader.c>
#define INTS_PER_SECOND 25 // (4000000/(4*16*250*10)
// set up timer
set_timer_2(T2_DIV_BY_16,250,10);
int8 seconds; //A running seconds counter
int8 int_count; // Numbering of interrupts left before a second has elapsed

#INT_TIMER2 // This function is called every time

void clock_isr(){ // Timer2 overflows (250 to 0) which is approaximately 25 times per second for this program

if(--int_count==0){
++seconds;
int_count=INTS_PER_SECOND;
}
}

void main(void)
{
int time;
unsigned int second;
unsigned int control; // 0=250
int_count=INTS_PER_SECOND;
set_timer_2(T2_DIV_BY_16,250,10);
set_timer2(0);
enable_interrupts(INT_TIMER2);
ENABLE_INTERRUPTS(global);

while (TRUE)
{
printf("press any key to begin.\n\r");
getc();
int_count=INTS_PER_SECOND;
seconds=0;
printf("press any key to stop.\n\r");
getc();
printf("%u seconds.\n\r", seconds);
}
}
/*
for (time = 0; time < 10; time++){
delay_us(10);
second = read_set_up_timer();
printf("numb=%u,second;
printf("time=%u",time);
getc(0);
getc(10);
*/
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Jul 27, 2005 7:08 am     Reply with quote

change
Code:
  set_timer_2(...)

to
Code:
  set_timer2(...)
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group