The sample in the link will print the values as you are asking in your first post.Originally Posted by Eng4444
Please explain that again with a real example with numbers.
Luciano
The sample in the link will print the values as you are asking in your first post.Originally Posted by Eng4444
Please explain that again with a real example with numbers.
Luciano
Thanks for your interest , i will try to provide more details and hope they will be helpful for you.
But first, in that link, i am not using "ATN and HYP", nor "X and Y", nor arctan or arcos or logarith or interpolation...
all my work is that i am getting Power. It is given as you know by:
P = V x I x Cos alpha.
and i am using PIC 16F876A with PicBasic Pro.
I solved the matter of V and I by applying sensors. and for the phase between them, i used a PLL. now i am inserting all 3 variables as inputs for the PIC and i need it to give me the correct power but i discovered that it is giving very wrong values!
i found out that it's from the "cos" because as it is stated, the cosine give value in 2's complement from -127 to +127 and not in the traditional way from 0 to 359 degrees...
But for us, we use the traditional numbering system.... so i need to use it! But it is not working... i can do it with a table but i need to find out if there is a mathematical way to use the same function "cosine" , already provided..
thanks again and i hope you will be able to help me.
And out of this silly task you are able to make such a lot of dust ?Originally Posted by Eng4444
P=V*I 16 Bit
X=COS(Alpha*255/360) 8 Bit 2-komplement
Minus=X.7
P=P*(X and %01111111) 32 Bit !!!
P=Div32 127
It's quick-n-dirty, maybe there is an error inside....
And all the way without using this boring 0,xxx, only integers !
Ha, the good old times are back, where programmers must understand what they are doing and counting the bits...
Just USE YOUR BRAIN, not your mouth !
Hello Mel,
Yes, I ruin you prices and your time....
but I inserted 1 mistake, so this code will not work right. But some postings ago, there was the right hint. Maybe we could train his brain....
Last edited by BigWumpus; - 7th May 2006 at 22:21.
PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2
--------------------------------------------------------------------Originally Posted by BigWumpus
It's just that you like to show up... i wonder if you succeeded because for me you were just acting like a clown... trying to be nice to mel just by making fun of me.
i wonder what you get from all this - stupid... and moreover, you wanna train my brain? lol and you submit and error on purpose???!
i came here because i didn't know how to do it so do you really find it worthy to take all your advantages and try to make fun of me?? or just to appear the intelligent?? you are idiot! keep your knowledge for yourself.
In case someone else has an idea about my question i'll be grateful.
By the way Mel,
Did you made this forum just to make fun of people with your friends?
thanks a lot for your kindness.
It's not my forum. I just make sure folks don't abuse it (or each other) too much...
From your first post, I gather this is a serious project with a serious problem... unfortunately I only answer the frivolous ones - serious I leave to other people - unless there's money involved.
But really, to join a forum just in order to ask folks to drop what they're doing and IMMEDIATELY write code for you because you need it URGENTLY is really the height of bad manners - and you should expect a little fun to be made from it.
My original post pointed you to the fact that you CANNOT have fractions with PICBasic... ONLY INTEGERS. If you are capable of doing the circuit you describe, then you are also capable of a little high-school mathematics in converting degrees to radians. Then feeding that figure into the provided COS function and converting the resultant into the required COSINE but scaled-up because we must always work in INTEGERS.
You have been shown how to convert degrees to radians and how to get your Cosine function... a little bit of experimentation on your part will complete the code and you will have a working program. So make an effort, try to understand what's been written (thank you BigW), and don't expect everyone else to do it all for you...
See... this is why we're not getting rich on this forum... somebody always does it for free... *sob*
Nicely done Melanie.
I'm affraid I would have been much more severe.
However, my severeity would have been directed to everyone besides ENG4444.
Maybe it wasn't the best entrance to our forum, but. The words, idiot, stupid, and the dreaded F word came from well established users. Not the poor guy that made his first post here today. (originally)
As the "Bad Cop" I'd like to "Run you ALL in" for inciting a riot.
Fortunately, there's a "Good Cop" around that handles children better than I do.
<br>
DT
P.S. Luciano excluded!
I have joined several forums and it was the first time where i see people asking for money and the sentence "don't expect to do it for free".
it's a real big shame because orginally, that was the aim of forums in case some of you do not know.
in all cases, i don't wanna get far from my subject. I'm still asking that question and still waiting more answers![]()
Thanks Melanie a lot.
Your code is great and it worked perfectly.
Luciano,
Also a big thanks because that article is extremely important.
Bookmarks