Keil Logo Arm Logo

Discussion Forum

PWM for AT89C5115 (need informations)

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
laredj hal
Posted
23-Jun-2003 14:35 GMT
Toolset
C51
New! PWM for AT89C5115 (need informations)
hello, every body

i'm working with the AT89C5115 of ATMEL
and i want to generate a square pulse of 40Khz using the PCA( PWM, the capture or the timer ).
for the moment i coulndn't resolve the problem
PCA counter registers (CL and CH) doesn't increment even activated. ?
if some one have informations
i'll be gratefull
thanks in advance
Read-Only
Author
erik malund
Posted
23-Jun-2003 14:55 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
The "PCA cookbook" found at
http://www.intel.com/design/MCS51/applnots/27085101.PDF
gives suggestions and code for virtually any application of the PCA. I do not know your specific derivative (Atmel), but the Philips PCA implementations are extremely similar to those used in the Intel appnote.

Erik
Read-Only
Author
Werner Meier
Posted
27-Jun-2003 17:37 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
For a square Pulse of any Frequency I found the Timer 2 Output on P1.0 useful.

Werner
Read-Only
Author
laredj hal
Posted
3-Jul-2003 15:52 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
thanks for informations, but finally i didnt use the pwm to generate a burst of 40khz, it wasn't possible for more than 25khz.
so i wrote a function in assembly.
i used directly the port (p1) by putting directly 0's and 1's in such a way to have a frequency of 40khz.

for the timer2 through which pin we could generate the required signal, and i need two signals of 40khz.

thanks all
Read-Only
Author
swapna swapu
Posted
17-May-2005 06:27 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
hi,
well even i'm working with the atmel mc T89C5115 and i havent found the logic for programming the PCA to generate a 25KHz freq wave which has 10% duty cycle. i wud be really thankful if u wud share any logic that u have with me on this topic. the cookbook abt philips wasnt helpful in programming the PCA since i was not able to understand the codes it had in assembly and moreover the mc used there was different. thanks,
swapna
Read-Only
Author
erik malund
Posted
17-May-2005 14:26 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
have you even looked at the PCA cookbook?

Erik
Read-Only
Author
swapna swapu
Posted
18-May-2005 05:39 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
erik,
i have not only seen but read the cookbook and i found that it has information only about a few philips microcontrollers whereas i need information about atmel chips. moreover the code examples given there are in assembly which i'm not able to relate much to. the codes i wrote in C are giving me error as certain sfr's are not defined in particular register files.
so any information on atmel chips wud be helpful. thanks,
swapna.
Read-Only
Author
erik malund
Posted
18-May-2005 13:12 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
i found that it has information only about a few philips microcontrollers whereas i need information about atmel chips.
10 there is no info on "philips chips" in the cookbook, only Intel. Who cares, if you had taken the time to check, you would have seen that the Atmel implementation is the same (maybe with a small expansion here or there).
moreover the code examples given there are in assembly which i'm not able to relate much to.
Then I will not give .05 for you C. If you do not know the underlying workings of your controller (have made some assembler) your C will be woefully inefficient.

Erik
Read-Only
Author
swapna swapu
Posted
19-May-2005 04:31 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
Dear dear Erik,
there is no info on "philips chips" in the cookbook, only Intel. you dont need to tell me this as it is an INTEL cookbook. i can perfectly well realise that.
maybe with a small expansion here or there... i hope u realise very well that while involving urself in major projects "small expansions" play a very important role....if i cud do these small expansions myself i wudnt waste my time posting this query on the site. still i'm "thankful" for ur "valuable advice". Then I will not give .05 for you C. My efficiency in C does not require ur evaluation and my requirement in my project far exceeds and involves in improving the efficiency of my controller so OBVIOUSLY i'm confident in my knowledge abt my controller. Other than commenting on my efficiency i wud appreciate sum genuine TECHNICAL advice.
swapna.
Read-Only
Author
Stefan Duncanson
Posted
19-May-2005 09:12 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
"you dont need to tell me this as it is an INTEL cookbook. i can perfectly well realise that."

I'm curious, then, why you keep stating that it refers to Philips chips?

If you want to be taken seriously I suggest you avoid using the following childish nonsense:

u
urself
cud
wudnt
ur
abt
wud
sum
Read-Only
Author
Steve Clemson
Posted
19-May-2005 10:41 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
Perhaps Keil could apply a spell checker for all posts onto the board, and fire an error if any SMS-speak is detected in the post.

Something along the lines of "There is no 160 character limit on this board. Please use FULL words. Or go post somewhere else."
Read-Only
Author
erik malund
Posted
19-May-2005 13:13 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
since i was not able to understand the codes it had in assembly

OBVIOUSLY i'm confident in my knowledge abt my controller

That "confidence" is not worth much when you can not even read assembler.

Erik
Read-Only
Author
Jay Daniel
Posted
19-May-2005 13:21 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
I still can't get over the open acrimony toward SMS-style word abbreviation here. Did any of you that read his post actually have to stutter for even a moment to understand what he meant by those abbreviations? If not, then he's communicating effectively enough for something informal like this.

People on this board make the most abhorrent grammar errors every day--including some of those who are most vocal about SMS hatred. No one spends all day correcting those, so perhaps we should just let it go.
Read-Only
Author
Stefan Duncanson
Posted
19-May-2005 13:59 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
"I still can't get over the open acrimony toward SMS-style word abbreviation here. Did any of you that read his post actually have to stutter for even a moment to understand what he meant by those abbreviations?"

It took me considerably longer to read and understand his post than it would have without the SMS. English is my first language, I read it quickly without having to think about the meaning of the words. When it is riddled with SMS, however, I frequently have to stop and mentally translate the abbreviations before I can make sense of it. If English were not my first language I doubt I'd be able to make sense of it at all.

"If not, then he's communicating effectively enough for something informal like this."

He could communicate much more effectively if he wrote English, which he is clearly capable of, rather than SMS. Making one's question as clear and easy to understand as possible is the best way to elicit a useful response, and shows that one at least has some respect for those one is asking for free advice from.

"People on this board make the most abhorrent grammar errors every day--including some of those who are most vocal about SMS hatred. No one spends all day correcting those"

Of course. The essential difference, though, is that grammatical errors are unintentional, whereas use of SMS is a conscious decision. That is why nobody wastes time correcting them. You'll notice that some posters don't have a very good grasp of English - nobody criticises them either. In fact, I make a lot of effort to try to understand broken English.

"so perhaps we should just let it go."

In some cases I don't think so. Generally I just ignore posts that contain a lot of SMS, but when the poster combines this with a refusal to take the advice he's been given I sometimes feel the need to say something.
Read-Only
Author
Jay Daniel
Posted
19-May-2005 14:46 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
It took me considerably longer to read and understand his post than it would have without the SMS. English is my first language, I read it quickly without having to think about the meaning of the words. When it is riddled with SMS, however, I frequently have to stop and mentally translate the abbreviations before I can make sense of it. If English were not my first language I doubt I'd be able to make sense of it at all.

Perhaps that's the flaw in my thinking. I assume that since I can scan through it at the same rate as standard English, then everyone else can as well. Also, I think the claim about non-native English speakers having more difficulty with SMS abbreviations is dubious. I would wager that swapna has a high probability of falling into that category himself (based solely on his name), but he seems to find it easier.

My guess is that as internet and other forms of text based communications between continents become commonplace, these abbreviations will become a part of the worldwide English that people use. Think of it as a sort of Esperanto for people who don't want to wear out their thumbs using their blackberry. :)

Of course. The essential difference, though, is that grammatical errors are unintentional, whereas use of SMS is a conscious decision. That is why nobody wastes time correcting them. You'll notice that some posters don't have a very good grasp of English - nobody criticises them either. In fact, I make a lot of effort to try to understand broken English.

I'm not sure this sort of unintentional mistake is somehow more benign. For isntance, plenty of people don't know the appropriate situations to use your or you're. They never learned it, and they just choose whichever they like when they feel like it. Someone who KNOWS that they don't know it well enough, however, might just use "ur" in both situations knowing that they'll be conveying their intent clearly enough in either case. I guess I just find the former more irritating. "To each his own" I suppose.
Read-Only
Author
erik malund
Posted
19-May-2005 15:04 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
Someone who KNOWS that they don't know it well enough, however, might just use "ur" in both situations knowing that they'll be conveying their intent clearly enough in either case.
Clearly???

How can microresistor be a clear representation of your?

It is NOT that I can not understand it, it IS that when I see $#|+ like this I have to stop and think, not about the problem the poster tries to describe, but about the word(s) (s)he uses.

I am not a "native english speaker" and I am sure that I make gramatical errors now and then, but for me (the "non-native english speaker") A gramattical error is not a problem in reading whereas "it is a 4gone tht Ur msg r a rply" will take me an effort to read, thus often missing what the message is trying to convey.

I will, however agree that a post with 4 times "you" and one "u" should be considered a freudian slip and not an insult.

Erik
Read-Only
Author
Stefan Duncanson
Posted
19-May-2005 16:01 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
"Also, I think the claim about non-native English speakers having more difficulty with SMS abbreviations is dubious."

If the non-native speaker is familiar with SMS I agree, if not it's just another difficulty to deal with.

"My guess is that as internet and other forms of text based communications between continents become commonplace, these abbreviations will become a part of the worldwide English that people use."

I've seen a lot of discussion on Usenet about the reasons why adults, particularly those from the Indian sub-continent, use SMS abbreviations in normal written communication and the concensus seems to be that they do it because they think it is a 'kewl' thing they have copied from the British and Americans.

"I'm not sure this sort of unintentional mistake is somehow more benign. For isntance, plenty of people don't know the appropriate situations to use your or you're. They never learned it, and they just choose whichever they like when they feel like it. Someone who KNOWS that they don't know it well enough, however, might just use "ur" in both situations knowing that they'll be conveying their intent clearly enough in either case."

That's quite an elaborate justification for 'ur', but it can't be applied to any of the other bits of SMS speak I pulled out of that post (unless you can imagine 'you'reself' being a word):

u
urself
cud
wudnt
abt
wud
sum

'sum' instead of 'some' really is ridiculous. It doesn't just obfuscate the text, it changes the meaning.
Read-Only
Author
Jay Daniel
Posted
19-May-2005 18:20 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
That's quite an elaborate justification for 'ur', but it can't be applied to any of the other bits of SMS speak I pulled out of that post (unless you can imagine 'you'reself' being a word):

u
urself
cud
wudnt
abt
wud
sum

'sum' instead of 'some' really is ridiculous. It doesn't just obfuscate the text, it changes the meaning.


I wasn't really trying to justify just "ur," but the whole premise in general as not being as bad as people here make it out to be. On a case-by-case basis, I'm sure there are a great number of common SMS-style abbreviations that are utter nonsense when framed like that.

But if we want to look at them one at a time (and why not. . . I'll take a break from coding for a moment), "some" is a exception to English phonetic rules. Normally, placing an "e" at the end of a word would force the "hard" form of a vowel (that is, without the exception, "some" would rhyme with "Rome"). Instead, for some ungodly reason, it's pronunciation has mutated into a schwa sound. So, "sum" is probably a more justifiable spelling based on phonetics.

Anyhow... I don't want to start a big battle over this. I certainly won't continue the debate into other threads. It just seems like sometimes it's trivialities like the SMS debate that take up more room in the forums than actual technical questions and solutions.
Read-Only
Author
erik malund
Posted
19-May-2005 18:39 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
It just seems like sometimes it's trivialities like the SMS debate that take up more room in the forums than actual technical questions and solutions.

You just proved my point. When you have to decipher the message, the words become the important part, not the message.

Erik
Read-Only
Author
Stefan Duncanson
Posted
20-May-2005 09:41 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
"So, "sum" is probably a more justifiable spelling based on phonetics."

Ok, I read a sentence and see the word 'sum' in a peculiar context. I stop, give it some thought and realise that the author meant 'some' but misspelled it because the words sound the same. I understand the sentence.

Next, a reader who doesn't know English too well reads the sentence. Hmm, what does this word 'sum' mean? He checks the dictionary. He re-reads the sentence. He knows what all the words mean but can make no sense of the sentence.

"Anyhow... I don't want to start a big battle over this."

Indeed, nor do I. This subject comes up over and over again on Usenet, the same arguments for and against are trotted out each time, but the conclusion is usually this:

If everybody posting to an English language forum makes their best effort to write comprehensible English then everybody benefits.

"It just seems like sometimes it's trivialities like the SMS debate that take up more room in the forums than actual technical questions and solutions."

I agree. That is why I usually just ignore posts with a lot of SMS in them. Which, of course, doesn't really help the poster.
Read-Only
Author
Jay Daniel
Posted
20-May-2005 13:27 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
Next, a reader who doesn't know English too well reads the sentence. Hmm, what does this word 'sum' mean? He checks the dictionary. He re-reads the sentence. He knows what all the words mean but can make no sense of the sentence.

Actually, he'll probably see that "sum" in the dictionary is a noun, whereas it's being used in a sentence as an adjective and he will remain unable to decipher the message, but for an entirely different reason. :)

Indeed, nor do I. This subject comes up over and over again on Usenet, the same arguments for and against are trotted out each time, but the conclusion is usually this:

If everybody posting to an English language forum makes their best effort to write comprehensible English then everybody benefits.


I don't spend much time on Usenet, so I wasn't aware that this was a re-hash. Anyhow... I can agree with your conclusion that people should make their best effort at proper English. I certainly have some of my own language pet peeves. I just thought I'd try and see what everyone thought the big deal was. Thanks for entertaining the debate.
Read-Only
Author
Jay Daniel
Posted
19-May-2005 14:47 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
It took me considerably longer to read and understand his post than it would have without the SMS. English is my first language, I read it quickly without having to think about the meaning of the words. When it is riddled with SMS, however, I frequently have to stop and mentally translate the abbreviations before I can make sense of it. If English were not my first language I doubt I'd be able to make sense of it at all.

Perhaps that's the flaw in my thinking. I assume that since I can scan through it at the same rate as standard English, then everyone else can as well. Also, I think the claim about non-native English speakers having more difficulty with SMS abbreviations is dubious. I would wager that swapna has a high probability of falling into that category himself (based solely on his name), but he seems to find it easier.

My guess is that as internet and other forms of text based communications between continents become commonplace, these abbreviations will become a part of the worldwide English that people use. Think of it as a sort of Esperanto for people who don't want to wear out their thumbs using their blackberry. :)

Of course. The essential difference, though, is that grammatical errors are unintentional, whereas use of SMS is a conscious decision. That is why nobody wastes time correcting them. You'll notice that some posters don't have a very good grasp of English - nobody criticises them either. In fact, I make a lot of effort to try to understand broken English.

I'm not sure this sort of unintentional mistake is somehow more benign. For isntance, plenty of people don't know the appropriate situations to use your or you're. They never learned it, and they just choose whichever they like when they feel like it. Someone who KNOWS that they don't know it well enough, however, might just use "ur" in both situations knowing that they'll be conveying their intent clearly enough in either case. I guess I just find the former more irritating. "To each his own" I suppose.
Read-Only
Author
erik malund
Posted
19-May-2005 15:28 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
plenty of people don't know the appropriate situations to use your or you're. They never learned it, and they just choose whichever they like when they feel like it. Someone who KNOWS that they don't know it well enough, however, might just use "ur" in both situations knowing that they'll be conveying their intent clearly enough in either case.

non-native, I may state the right as the wrong and the wrong as the right, but here we go:
If I write "I value your opinion" and the correct would be "I value you're opinion" is the a problem with conveying my intent bigger that if I wrote "I value ur opinion"

Erik
Read-Only
Author
Jay Daniel
Posted
19-May-2005 18:11 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
non-native, I may state the right as the wrong and the wrong as the right, but here we go:
If I write "I value your opinion" and the correct would be "I value you're opinion" is the a problem with conveying my intent bigger that if I wrote "I value ur opinion"


No... my assertion is that they're both about on-par as far as the affect to readability they cause. As such, my assertion is that we should just let them BOTH go rather than cluttering up threads with reprobation about someone's style of writing. (Or, for that matter, cluttering up the thread like I have with a debate :)
Read-Only
Author
Alicia SK
Posted
20-May-2005 04:44 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
i was just going through this enitre thread for some information i needed, but i quite enjoyed the literal debate.
i never once thought that entering your queries into this forum required a literature degree. do you guys mean that language is more important than the intelligence sharing? so long as the communication is effective i do not think that there should be any debate over superiority of Asian, American or British English.
personally i appreciate people like Jay Daniel who have understood the actual purpose of this thread without getting lost in the language debate. i guess i found valuable information only in his message. thanks a lot.
Read-Only
Author
Stefan Duncanson
Posted
20-May-2005 09:23 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
" was just going through this enitre thread for some information i needed, but i quite enjoyed the literal debate."

It's a pity, then, that you seem to have missed the point of it.

"i never once thought that entering your queries into this forum required a literature degree"

It doesn't.

"do you guys mean that language is more important than the intelligence sharing"

No. Sharing knowledge is the purpose of this forum. The debate is whether that sharing of knowledge is facilitated by the inclusion of SMS abbreviations.

"so long as the communication is effective..."

Quite.

"... i do not think that there should be any debate over superiority of Asian, American or British English."

There hasn't been. The debate has been about SMS abbreviations. You did read the thread, didn't you?

"personally i appreciate people like Jay Daniel who have understood the actual purpose of this thread without getting lost in the language debate. i guess i found valuable information only in his message. thanks a lot."

I think you found what you wanted to find in this thread rather than what was actually there.
Read-Only
Author
erik malund
Posted
20-May-2005 13:37 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
I never once thought that entering your queries into this forum required a literature degree. do you guys mean that language is more important than the intelligence sharing? so long as the communication is effective

There is no need for a "literature degree" all that is asked is "your best effort".
If you consider "I save 2 seconds by using SMS, the hell with the reader" you best effort, be sure you are in a minority.

language is more important than the intelligence sharing
You screwed that quote up royally, the correct statement is "clear, unambigous language is required for intelligence sharing"

so long as the communication is effective
How can spending the effort on understanding the words, rather than the sentecnce be "effective communication"

Erik
Read-Only
Author
erik malund
Posted
19-May-2005 14:21 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
Jay,

I still can't get over the open acrimony toward SMS-style word abbreviation here. Did any of you that read his post actually have to stutter for even a moment to understand what he meant by those abbreviations?
Yes, I had to decipher, rather than read.

Many have stated "I write SMS because it is faster to write" OK, so you one save some time and the many readers will have to spend more time deciphering your message. Thus someone using SMS is, in fact saying "my time is more valuable than all other members of the forum combined".

People on this board make the most abhorrent grammar errors every day-- Sure, but that is not done intentionally to save time at the cost of others.

Erik
Read-Only
Author
Jay Daniel
Posted
19-May-2005 13:34 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
swapna,

How to do this depends a bit on your clock frequency. Take a look at the datasheet for your chip. On page 76 it details the CMOD register. Two of the bits in this SFT are used for selecting the source for the PWM. This is how you control the PWM's frequency. As you can see, it can be a fixed fraction of the clock frequency, or if you need a specific frequency, it can be clocked from an overflow on a timer.

The duty cycle is set by using the CCAPxH and CCAPxL registers, where x is the number of the PCA module you're using as a PWM. What happens is that the PCA counter counts up from 0x00 to 0xFF. Whenever the value of the counter is BELOW the value in CCAPxL, the output on that PCA module's pin is LOW. Whenever the value is HIGHER than CCAPxL, the output is high. CCAPxH is important because you don't load new values into CCAPxL directly. You put the desired value in CCAPxH and the hardware loads it for you when the PCA counter overflows.

There are, of course, other important details involved, like how to put the PCA into PWM mode, but these are ALL included in the cookbook that everyone keeps admonishing you to read.

As far as assembly versus C, if you've included the header files from Keil, writing a value to a register is simple. For instance, if you want to load 0x55 into the CCON register, just write

CCON = 0x55;
Read-Only
Author
swapna swapu
Posted
20-May-2005 04:49 GMT
Toolset
C51
New! RE: PWM for AT89C5115 (need informations)
jay,
thank you for the information on PCA. it was a lot helpful.
Also a thank you to Alicia for being so supportive.
swapna

Next Thread | Thread List | Previous Thread Start a Thread | Settings

arm-logo-small

Keil logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.