The last Fourth Wish


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    New York US
    Posts
    46


    Did you find this post helpful? Yes | No

    Lightbulb

    Dear Henrik,
    Always when we speak about feedback than best solution is analog schematics.
    Unfortunately, especially when needs to generate frequency in SWEEP MODE.
    Start at 200KHz and go up with 10 Hz step until schematics find optimum.
    When optimum frequency is found then needs continuously adjust frequency by monitoring voltage
    on serial/parallel resonance output LC module and keep it close to zero.
    Using traditional PIC architecture does not allow to do that.
    So idea about dual core PIC with bridges between registers keeping variables is advance move in right direction.
    Few words about USART. I read all literature and could not found how assigned
    PORTB.Pin can send periodically variable values to serial LCD without involving
    CPU resources for example 4 times per Sec.
    About Propeller Chip: It is really good for gathering information, scaling data, and
    sending data to storage.For me 8 CPU is too much and will never be using in any hobby applications
    except special industrial ones.Will be better if manufacturer design
    this chip with 2-4 cores and inner bridges between registers.It will give more freedom.
    Best Regards to All

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I don't know enough info about your paritcular project to tell if it is doable with a PIC or not - maby it is, maby it isn't. You asked how it was possible to send a serial message lasting 2ms and have the PIC output 200kHz PWM signal at the same time. I showed you one possible way of doing that - by using the CCP module to generate the PWM and the USART to send the serial message. That way I'd guess 99% of the CPU time is still available.

    Of course the CPU needs to be involved even when using the USART but the difference in amount of involvement compared to bitbanging a character is massive. Really, all the CPU needs to do is load the USART TX-register with the character to be sent, takes one maby two instruction cycles then it can continue doing other thing while the USART sends the character. When the USARTs transmit buffer is ready for another character it sets a flag which you can either poll or have generating an interrupt.

    To send something periodically you use another one of the PICs hardware timers setup to generate an interrupt at a certain frequency. The interrupt service routine then either does the whole thing, sending the message (usually not a good aproach) or it simply initiates the sending by loading the first character into the USART TX-register and activating the TX-interrupt so that when the first character is sent you get another interrupt so you can load the next character etc etc. When the whole message is sent the you deactivate the TX-interrupt.

    In my servo drive project I've been working on for long time the PIC counts step- and direction pulses at up to ~100kHz, reads an incremental encoder at up to 2.5MHz updating a 32bit position register, runs the PID loop at 1220Hz, drives the output bridge with a 20kHz PWM signal, sends and recieves serial messages at 115200baud AND blinks a LED - all at "the same time". It's not done magically with a single command, you have to make it happen.

    /Henrik.

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    As you and I have pointed out, doing multiple things at apparently the same time is easily possible - you have to make it happen.

    The main issue that the OP has is that he wants to sweep a PWM output from 200KHz to 500KHz with 10Hz resolution/steps using the PIC.

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