adcin and HPWM


Closed Thread
Results 1 to 25 of 25

Thread: adcin and HPWM

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I found a working program from steve in another thread:
    @ DEVICE MCLR_ON, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
    OSCCON=$60 ' use internal 4MHZ osc
    PAUSE 100 ' start-up delay
    TRISB=0
    DEFINE CCP1_REG PORTB
    DEFINE CCP1_BIT 3
    HPWM 1,128,1000
    HERE: GOTO HERE

    I just change the oscillation to 20Mhz, and it si not working: I think this is the problem..
    I change the program to:

    @ DEVICE MCLR_ON, HS_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
    DEFINE OSC 20 'use external 20mhz crystal 'OSCCON=$60 ' use internal 4MHZ osc
    PAUSE 100 ' start-up delay
    TRISB=0
    DEFINE CCP1_REG PORTB
    DEFINE CCP1_BIT 3
    HPWM 1,128,1000
    HERE: GOTO HERE

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    CCPMX_ON .... that should be off....
    That's one problem I'm thinking of. Not reading the right pin...

    Quote Originally Posted by lerameur View Post
    I found a working program from steve in another thread:
    Look at your manual under HPWM. Can't do 1000 Hz at 20Mhz...

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    19531Hz for a 20Mhz

    I remember using 5Khz for one of my project for motor driver PWM.

    How can I change steve's program to use a 20Mhz crystal?

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    19531Hz for a 20Mhz

    I remember using 5Khz for one of my project for motor driver PWM.

    How can I change steve's program to use a 20Mhz crystal?
    The MINIMUM is 1221 hz, the max is 19531 hz. Can't do a lot about is, built into the hardware.
    Steve has a program called MultiCalc. Check it out...

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    well 10800hz fall well within those range , so no problem there.

    k

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    well 10800hz fall well within those range , so no problem there.
    Ok... In the last couple of posts, the freq wasn't 10.8khz.

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I changed the header to
    INCLUDE "modedefs.bas" 'Includes supoprt for PicBasic language
    @ DEVICE pic16F88,CCPMX_ON

    ' Setup Crystal oscillator Frequency to be used by PIC chip in MHz
    DEFINE OSC 20 'use external 20mhz crystal


    and it is now working.

    Ok... In the last couple of posts, the freq wasn't 10.8khz.
    ....really? I only see 10800hz in my post, where is the typo

    k

Similar Threads

  1. ADCIN > HPWM but with min/max limits - i failed maths
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th November 2009, 02:02
  2. 16F684 adcin and hpwm
    By astouffer in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st November 2008, 17:29
  3. Portc.3 latching?
    By Bronurstomp in forum mel PIC BASIC
    Replies: 4
    Last Post: - 10th November 2008, 17:47
  4. PIC16F819 HPWM CCP1 clariffication
    By earltyso in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th March 2008, 18:43
  5. Newbie HPWM / ADC question
    By Johan in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 25th June 2007, 12:52

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