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 support@ccsinfo.com

18F4431 - setup_timer_5() is not documented...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

18F4431 - setup_timer_5() is not documented...
PostPosted: Fri Jun 11, 2004 2:04 pm     Reply with quote

Hi,

What is the format of the setup_timer_5() function? Same as setup_timer_1() or is it the same as setup_timer_2()? Or is it completely different altogether?

Thanks!

Lloyd
Ttelmah
Guest







Re: 18F4431 - setup_timer_5() is not documented...
PostPosted: Fri Jun 11, 2004 2:40 pm     Reply with quote

LloydSargent wrote:
Hi,

What is the format of the setup_timer_5() function? Same as setup_timer_1() or is it the same as setup_timer_2()? Or is it completely different altogether?

Thanks!

Lloyd

Read the include file for the processor.
This is general advice for _all_ such questions. There are a series of things that have to be read together to make sense of the CCS routines. These are:
The CCS manual
The latter 'readme'
The .h file for the processor
The data sheet for the pocessor
The available division ratios etc., are documented in the chips data sheet, and if you then look at the .h file, you will see what strings are used for each possible option. The include file really forms an integral part of the 'documentation' for each processor, but this is not made clear.

Best Wishes
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Fri Jun 11, 2004 2:55 pm     Reply with quote

Hi,

Thanks for the RTFM reply, but it doesn't answer my question. Prior to the initial post:

1) Read the manual
2) Read the the readme
3) Read the .h file
4) Read the data sheet
5) PRIOR to any of this I did the division ratios (good software is built upon good design).
6) 20+ years designing embedded realtime software
7) Got a degree in Computer Science

I had hoped to save a wee bit of time by asking a question. Instead I not only got a rude response, but STILL am left without an answer.

So, does anyone else OTHER than Ttelmah have an answer? Something that is on the order of helpful rather than an insult?

Thanks,

Lloyd
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

PostPosted: Fri Jun 11, 2004 3:03 pm     Reply with quote

LloydSargent wrote:
Hi,

Thanks for the RTFM reply, but it doesn't answer my question. Prior to the initial post:

1) Read the manual
2) Read the the readme
3) Read the .h file
4) Read the data sheet
5) PRIOR to any of this I did the division ratios (good software is built upon good design).
6) 20+ years designing embedded realtime software
7) Got a degree in Computer Science

I had hoped to save a wee bit of time by asking a question. Instead I not only got a rude response, but STILL am left without an answer.

So, does anyone else OTHER than Ttelmah have an answer? Something that is on the order of helpful rather than an insult?

Thanks,

Lloyd


Try using

#byte reg. name = address
#bit name.bit

At this will avoid using assembly and will keep it more readable.
Good luck.
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Fri Jun 11, 2004 3:10 pm     Reply with quote

Okay, let me be more explicit. The following does not compile:

setup_timer_5(T5_DIV_BY_8);

Does not compile - I get "Undefined identifier setup_timer_5"

setup_timer_5(T5_DIV_BY_8, 255, 1);

Also does not compile - I get "Undefined identifier setup_timer_5"

This is all despite what the 18F4431.h which says:

Code:

// Timer 5 Functions: SETUP_TIMER_5, GET_TIMER5, SET_TIMER5
// Constants used for SETUP_TIMER_5() are:
//      (or (via |) together constants from each group)
#define T5_DISABLED         0
#define T5_INTERNAL         0x01
#define T5_EXTERNAL         0x07
#define T5_EXTERNAL_SYNC    0x03

#define T5_DIV_BY_1         0
#define T5_DIV_BY_2         0x08
#define T5_DIV_BY_4         0x10
#define T5_DIV_BY_8         0x18


Thus I am coming to the conclusion that :

a) The function setup_timer_5() does not exist
b) The header is in error
c) Or both

Cheers,

Lloyd
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Fri Jun 11, 2004 3:13 pm     Reply with quote

Hans Wedemeyer wrote:

Try using

#byte reg. name = address
#bit name.bit

At this will avoid using assembly and will keep it more readable.
Good luck.


Well, I had hoped to use standard functions - but it is beginning to look rather grim as the standard functions may not really be there (despite what the headers might say).

Thanks for your help!

Cheers,

Lloyd
Hans Wedemeyer



Joined: 15 Sep 2003
Posts: 226

View user's profile Send private message

Try this
PostPosted: Fri Jun 11, 2004 8:59 pm     Reply with quote

LloydSargent wrote:
Okay, let me be more explicit. The following does not compile:

setup_timer_5(T5_DIV_BY_8);

Does not compile - I get "Undefined identifier setup_timer_5"

setup_timer_5(T5_DIV_BY_8, 255, 1);

Also does not compile - I get "Undefined identifier setup_timer_5"

This is all despite what the 18F4431.h which says:

Code:

// Timer 5 Functions: SETUP_TIMER_5, GET_TIMER5, SET_TIMER5
// Constants used for SETUP_TIMER_5() are:
//      (or (via |) together constants from each group)
#define T5_DISABLED         0
#define T5_INTERNAL         0x01
#define T5_EXTERNAL         0x07
#define T5_EXTERNAL_SYNC    0x03

#define T5_DIV_BY_1         0
#define T5_DIV_BY_2         0x08
#define T5_DIV_BY_4         0x10
#define T5_DIV_BY_8         0x18


Thus I am coming to the conclusion that :

a) The function setup_timer_5() does not exist
b) The header is in error
c) Or both

Cheers,

Lloyd


I think you have fallen prey to CCS's sloppy documentation.
Notice at the end of that comment int the header file it is labled TIMER 3 !

A lot ot copy paste going on, and they made the mistake when they wrote Setup_Timer_1() and copied it.
There is no such function...

Try Setup_Timer5(variables here) ;
Notice NO underscore between r and 5 !

Good luck.
Hans W
ttelmah
Guest







PostPosted: Sat Jun 12, 2004 2:43 am     Reply with quote

LloydSargent wrote:
Hi,

Thanks for the RTFM reply, but it doesn't answer my question. Prior to the initial post:

1) Read the manual
2) Read the the readme
3) Read the .h file
4) Read the data sheet
5) PRIOR to any of this I did the division ratios (good software is built upon good design).
6) 20+ years designing embedded realtime software
7) Got a degree in Computer Science

I had hoped to save a wee bit of time by asking a question. Instead I not only got a rude response, but STILL am left without an answer.

So, does anyone else OTHER than Ttelmah have an answer? Something that is on the order of helpful rather than an insult?

Thanks,

Lloyd

What I posted was not an 'insult', but rather a general comment that applies to perhaps 30% of the posts here, and is because of the appalling way the CCS compiler is documented....
If you want to avoid getting the 'simple' answer, then post your question in a manner to make it plain that you had allready tried the simple solutions. You did not. You also did not report what the actual error you were seeing was. If you read the error, you immediately see that it is 'setup_timer_5' that it is complaining about, and _not_ the syntax of it's variables. As such, you asked the wrong question.

Now given that the strings you are using, are the correct ones from the .h file, then the 'answer' is that the format of the setup function is wrong. Unfortunately, this is probably a fault with the compiler, but some 'guesses' come to mind:
Try using setup_timer_3, and see what addresses this refers to.
Historically, on a couple of occasions when new 'higher numbered' peripherals have been added to chips, CCS, have modified the 'old' functions, and forgotten to change the numbering to match for a few compiler versions. So (for instance) you had the situation on the 12F675, that the function controlling the pullup resistors, was for port B, despite the chip not having this port. Latter this was ammended. That this may be the case, is supported by the include file, which shows signs of being cut and pasted from the setup_timer_3 text for another chip.
If it works with setup_timer_3, then just add a define to redclare the name, and remove this when they get the compiler fixed.
As Hans has said, they also have the annoying habit of sometimes adding/removing the need for the '_' character, and you should also try without this.

Best Wishes
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 9:05 am     Reply with quote

ttelmah wrote:

What I posted was not an 'insult', but rather a general comment that applies to perhaps 30% of the posts here, and is because of the appalling way the CCS compiler is documented....
If you want to avoid getting the 'simple' answer, then post your question in a manner to make it plain that you had allready tried the simple solutions. You did not. You also did not report what the actual error you were seeing was. If you read the error, you immediately see that it is 'setup_timer_5' that it is complaining about, and _not_ the syntax of it's variables. As such, you asked the wrong question.

Now given that the strings you are using, are the correct ones from the .h file, then the 'answer' is that the format of the setup function is wrong. Unfortunately, this is probably a fault with the compiler, but some 'guesses' come to mind:
Try using setup_timer_3, and see what addresses this refers to.
Historically, on a couple of occasions when new 'higher numbered' peripherals have been added to chips, CCS, have modified the 'old' functions, and forgotten to change the numbering to match for a few compiler versions. So (for instance) you had the situation on the 12F675, that the function controlling the pullup resistors, was for port B, despite the chip not having this port. Latter this was ammended. That this may be the case, is supported by the include file, which shows signs of being cut and pasted from the setup_timer_3 text for another chip.
If it works with setup_timer_3, then just add a define to redclare the name, and remove this when they get the compiler fixed.
As Hans has said, they also have the annoying habit of sometimes adding/removing the need for the '_' character, and you should also try without this.

Best Wishes


I disagree. It was an insult to a) newbies and b) experienced programmers. Here is how to determine if it was an insult: if it ticks someone off, then it was an insult. I suspect 30% of the people posting also are taking it as an insult. A response of RTFM is not help (despite what you might think). An answer is.

Your second paragraph IS an answer. Had you merely written that the first time you would not have had my ticked off response.

TTelmah, you may want to look at Hans initial response. It wasn't an answer, but offered a potential solution. Your second paragraph (above) also offers a direction.

Remember, folks, that in all communications, you want to follow a golden rule: treat others as you would have others treat you. This means that if it takes 5 minutes to write an insult or 5 minutes to supply an answer (even for the 40th time) it is always best to supply an answer.

And if you feel the need to say "RTFM", don't respond at all. It is neither helpful or instructive.

Cheers,

Lloyd
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 9:31 am     Reply with quote

Okay, here's what doesn't work:

setup_timer_5(T5_INTERNAL);
setup_timer5(T5_INTERNAL);
setuptimer_5(T5_INTERNAL);
setuptimer5(T5_INTERNAL);
setup_timer_3(T5_INTERNAL);
setup_timer3(T5_INTERNAL);
setuptimer_3(T5_INTERNAL);
setuptimer3(T5_INTERNAL);

All come back with "Undefined identifier setup..." and the function identifier. So it doesn't look like I'm going to hack this baby <sigh>.

Cheers,

Lloyd
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 9:32 am     Reply with quote

Ttelemah does not insult people.

I might, in a minor way, but he doesn't.
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 9:49 am     Reply with quote

PCM programmer wrote:
Ttelemah does not insult people.

I might, in a minor way, but he doesn't.


That may be your opinion. My opinion is that RTFM replies are insults, whether intended or not.

As a simple example, let us say you see someone on the side of the road. They have a flat and (due to reasons) have never changed a tire before. Would you say "RTFM" and drive off? Or would you assist them in changing the tire?

Whether you or he consider it to be an insult is irrelevant. What is important is how the RECEIVER perceives it. That is the nature of communication.

Cheers,

Lloyd
SteveS



Joined: 27 Oct 2003
Posts: 126

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 10:15 am     Reply with quote

- I should stay out of this but Ttelmah is one of the most helpful people on this list, so...

[soapbox]
We get a lot of 'newbie' questions - many are good, some show little work on the part of the questioner. In addition even an experienced programmer, new to CCS, may miss important documentation, since the manual is way behind the compiler. The readme and header files are critical and often overlooked. You seem to have joined recently and these are things you might not have been aware of. I saw nothing insulting in his reply, but it is up to you to decide how to perceive things. In a list covering many countries, cultures, and abilities one should always give a lot of leeway before taking offense. Go thru the archive and show me examples where Ttelmah has been 'rude'. I don't think you will find any. Heck I just a posted question that I could've searched the data sheets to answer. Ttelmah and others kindly saved me a lot of time - there was an instance where a RTFM answer might have been acceptable.
[/soapbox]

Anyway, take it all with a grain of salt - you will find this list to be very useful and we hope you can contribute to it as well. The error you're finding seems to be a new one and we'll all benefit from it's resolution.


-SteveS
Ttelmah
Guest







PostPosted: Mon Jun 14, 2004 10:20 am     Reply with quote

LloydSargent wrote:
PCM programmer wrote:
Ttelemah does not insult people.

I might, in a minor way, but he doesn't.


That may be your opinion. My opinion is that RTFM replies are insults, whether intended or not.

As a simple example, let us say you see someone on the side of the road. They have a flat and (due to reasons) have never changed a tire before. Would you say "RTFM" and drive off? Or would you assist them in changing the tire?

Whether you or he consider it to be an insult is irrelevant. What is important is how the RECEIVER perceives it. That is the nature of communication.

Cheers,

Lloyd

I think if the person was standing beside the road, you stopped, and he said 'can you tell me how to change a tyre', the right answer _would_ be 'RTFM'. If instead he said 'I am having problems undoing this nut', and 'could you help', then a more useful reply might follow.
The _question_ was wrongly phrased, and got the answer to what was asked...

Best Wishes
LloydSargent



Joined: 11 Jun 2004
Posts: 13

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 10:44 am     Reply with quote

The original question was whether the format of setup_timer_5() was the same as setup_timer_1(). Or something completely different?

The question was CORRECTLY phrased. It just never got an answer.

What are the answers?

a) It is the same as setup_timer_1()
b) It is the same as setup_timer_2()
c) It does not appear to work in the compiler

THOSE, my friends, are the answers. As it turns out, after some hacking (read: wasting time), it doesn't work at all. The compiler rejects it.

Cheers,

Lloyd
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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