Software PWM Problems


Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Nov 2005
    Posts
    6

    Default Software PWM Problems

    Hi! want to read the 8 Bit AD of the 12F675 an put it out as PWM with duty cyle between 0-100%.
    My Programm is working well, but when AD gets 5V, I get Pulses out with 400ĩS Pause. But at AD 5 V it should be permanently on, without Pulses
    I donīt know whats the problem.
    Here Is my Programm, I attached the Scope Picture.

    Define OSCCAL_1K 1 ' Calibrate internal oscillator

    ' Define ADCIN parameters
    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS


    LED Var GPIO.0 ' LED is bit 0, PIN 7

    adval var word ' Create adval to store result
    i var word

    ANSEL = %00111000 ' Set AN3 analog, rest digital
    CMCON = 7 ' Analog comparators off

    loop:
    ADCIN 3, adval ' Read channel 3 to adval
    i = 256 - adval
    I = i * 10
    Pulsout LED,adval ' Puls is 2,56 ms
    Pauseus i 'cycle = 5,12ms = 195 Hz

    Goto loop ' Do it forever

    End

    Hope, Someone could help me!
    Attached Images Attached Images  

Similar Threads

  1. Software PWM
    By muqasim in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2009, 14:21
  2. Software PWM using Timer1
    By muqasim in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2009, 11:49
  3. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  4. 2 PWM in 16F690 problems
    By ciendavila in forum mel PIC BASIC
    Replies: 9
    Last Post: - 27th April 2008, 09:03
  5. Variable PWM on 2 Channels using software.
    By Tissy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd September 2006, 01:34

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