Wrong values with COSINE!


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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!

  2. #2
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Arrow thanks...

    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

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You know, if I want a Pizza and I don't know how to make one...

    1. I look in a Cookbook and follow the recipie (for Cookbook read PICBasic manual)...
    2. I go to Cookery School and learn...
    3. I at least make an attempt at something and if it doesn't turn out right then perhaps somebody will feel sorry for me and help me out...
    4. I pay someone to bring it to my door...

    I sure as hell don't run down the street shouting "I'm hungry and I want someone to make me a Pizza NOW!" and when neighbours offer their recipies and suggestions I dismiss them without at least trying to understand what they're offering me...

    Quick (one minute of coding) and dirty 0-90 degree FREE Cosine demonstrator...

    If you don't like it... go write your own...
    If you want 91-359 Degrees... go write your own - it's not immediately obvious...
    If you don't like the precision... go write your own...
    ...I think you get the idea...

    Code:
    	Angle Var WORD
    	Cosine var WORD
    	Radian var BYTE
    	TempA var WORD
    	TempB var WORD
    
    	LCDOut $FE,1
    Loop:
    	For Angle=0 to 90
    		Gosub GetCosine
    		LCDOut $FE,$80,"Angle=",#Angle,"  ",$FE,$C0,"Cosine="
    		LCDOut #Cosine DIG 3,".",#Cosine DIG 2,#Cosine DIG 1,#Cosine DIG 0
    		Pause 1000
    		Next Angle
    	Goto Loop
    
    GetCosine:
    	Radian=(Angle+1)*255/360
    	TempA=COS(Radian)
    	TempA=TempA & %01111111
    	TempB=TempA*1000
    	Cosine=DIV32 127
    	Return
    Oh... and before you say anything to the contrary... yes it DOES work...

  4. #4
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    The precision you can achieve with your code is not the only issue.

    Luciano

    * * *

    Power factor / Dissipating the Myths

    By David Gibson

    Power factor is one of those subjects about which there seems to be a great deal of confusion and many misconceptions. The culprit is the the assertion that power factor = cos(Phi), Phi being the phase shift between voltage and current. While this is true under certain ideal conditions, there are many real-world instances where it is quite incorrect. This article will give you a basic introduction into power factor, and explain why cos(Phi) is not the whole answer.

    Read this article here:
    http://www.microconsultants.com/tips...t/pfarticl.htm

  5. #5
    Eng4444's Avatar
    Eng4444 Guest


    Did you find this post helpful? Yes | No

    Thumbs up Sorry i forgot one thing..

    Thanks Melanie a lot.

    Your code is great and it worked perfectly.


    Luciano,

    Also a big thanks because that article is extremely important.

Similar Threads

  1. WRITECODE stores wrong 14-bit word values in FlashMEM
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th June 2009, 04:35
  2. Looking at pic basic pro symbol values in mplab 8.15a simulator
    By ukemigrant in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 16th May 2009, 13:18
  3. Need help calculating OSC cap values
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 26th June 2008, 21:27
  4. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  5. 16F877A problem: "coupled" digital values
    By Lupo83 in forum General
    Replies: 16
    Last Post: - 4th December 2007, 12:46

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts