Generating 3-phase sine wave..


Closed Thread
Results 1 to 39 of 39

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Sylvio,

    This may sound silly, but are you sure it's a 20mhz crystal?

    A 4mhz crystal with that Timer1 reload value would give ~870 hz.
    <br>
    DT

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Sylvio,
    This may sound silly, but are you sure it's a 20mhz crystal?
    A 4mhz crystal with that Timer1 reload value would give ~870 hz.
    <br>
    For that matter, it might be running on the internal 4Mhz clock and ignoring the external completely.
    Pull the crystal out and see if it still runs at all...

  3. #3
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    What does this do on PortD.0?

    My point is that it looks like your program 'flow' is jacked up and needs to be reworked.
    I've done that. It shows 4330Hz...

    Quote Originally Posted by Darrel Taylor View Post
    Sylvio,

    This may sound silly, but are you sure it's a 20mhz crystal?

    A 4mhz crystal with that Timer1 reload value would give ~870 hz.
    <br>
    Yes, I am sure about it.. It is a 20Mhz Xtal.. Then ~900Hz is the frequency that the block (if flag = 1 ..) is running, but no the timer1 interrupt...

    Thanks !
    Sylvio,

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sirvo View Post
    I've done that. It shows 4330Hz...

    Yes, I am sure about it.. It is a 20Mhz Xtal.. Then ~900Hz is the frequency that the block (if flag = 1 ..) is running, but no the timer1 interrupt...

    Thanks !
    That's why I said you're program probably needs to be reworked.
    It's spending too much time inside the 'flag if/then' updating the values, therefore it appears to not be interrupting fast enough, when it's actually trying to get everything done that you want it to do. There's just not enough instruction cycles left between interrupts to get that update accomplished.

    (let's see if anybody gets this reference)
    I guess you could call it a 1201 or a 1202 Program Alarm.

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


    Did you find this post helpful? Yes | No

    Default

    I don't know Sylvio,
    I'm running it here and I don't see the same problem.

    But then, I've got a 16F887. Apples and Oranges...

    Timer1 runs at 4khz, and the IF block executes once after each FLAG, so it runs at 4khz too.

    The whole "block" including the LOOKUP and SAIDA: takes about 70us, so it's not taking too long.

    Unless there's something in the part of the program that wasn't posted. I'm stumped.
    <br>
    DT

  6. #6
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post

    I guess you could call it a 1201 or a 1202 Program Alarm.
    Gosh.. hope it isn't be happening...


    Darrel, did you notice that Timer2 is also running to generate the PWM frequency?

    I will remake the wires and test if the crystal is really being used (not as internal osc..)

    Thanks a lot!
    Sylvio,

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Maybe a difference or two (bug fix?) in an older version vs. newer version of the 'Instant Interrupts' related to the timers?

  8. #8
    Join Date
    Jan 2007
    Location
    Brazil
    Posts
    108


    Did you find this post helpful? Yes | No

    Default

    I've been using this one:
    Code:
    '****************************************************************
    '*  Name    : DT_INTS-14.bas                                    *
    '*  Author  : Darrel Taylor                                     *
    '*  Version : 0.93 BETA                                         *
    '*  Date    : JAN 29, 2006                                      *
    '****************************************************************
    '* Rev 0.93  Fixed CMIF and EEIF problem with older PIC's       *
    '*           that have the Flags in PIR1 instead of PIR2        *
    '* Rev 0.92  solves a "Missed Interrupt" and                    *
    '*           banking switching problem                          *
    Is there an update?
    Sylvio,

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sirvo View Post
    '* Version : 0.93 BETA *
    Is there an update?
    I thought it was farther along than .93b...but after a quick bit of looking, maybe not. Then again, maybe there are a few fixes here and there that just never had the 'official' update done.

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


    Did you find this post helpful? Yes | No

    Default

    .93 is the current version for the 14-bit pics.

    Do you have a CLEAR statement at the TOP of your program?
    <br>
    DT

Similar Threads

  1. To Generate Sine Wave Using PCPWM of PIC18F4331 (Issue)
    By Cyborg in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd March 2014, 13:39
  2. Sine wave
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 18th May 2009, 03:31
  3. 3 phase supply detector challenge
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th May 2009, 07:54
  4. 3 phase PWM with dsPIC30F2020
    By nemmard in forum mel PIC BASIC
    Replies: 1
    Last Post: - 21st January 2009, 14:19
  5. 3 phase sequencing
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2007, 07:35

Members who have read this thread : 1

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