Today 01:02
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 9
Today 00:59
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 21
Yesterday 18:41
Forum: Absolute Beginners Section
Starter: KevinPBaker
Views: 0
Replies: 5
Yesterday 17:07
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 0
Yesterday 10:19
Forum: Proton Plus Compiler v3
Starter: Fred Philpott
Views: 0
Replies: 2
Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Member amateurtje's Avatar
    Join Date
    Aug 2008
    Posts
    101
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    90.19 MB

    0 Not allowed!

    Default Problems on new PC (new version) with HPWM

    Hello,

    I have a problem with a script for a 18F46k22. When compiling on my old pc it works fine (I need to use my key). When compiling on my new pc, the program works but the HPWM part does not work (My motor does not rotate). I tried compiling with the key to see it has an effect but it does not help.
    My old PC:
    IDE: 2.0.3.3.
    Loader: 1.0.0.6
    Compiler: 3.5.7.1.

    my new pc:
    IDE: 2.0.3.3.
    Loader: 1.0.2.1
    Compiler: 3.6.0.3.

    At least everything on my new pc is newer..... The only thing I did on my old pc was compiling. The new pc was used to prgram the pic in both cases so it should really be the fault of the compiling process..

  2. #2
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,619
    Thumbs Up
    Received: 59
    Given: 18
    Total Downloaded
    2.27 GB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    You need to post a bit of code for testing, even a small piece of code that shows the anomaly.
    Regards

    Joseph

  3. #3
    Member amateurtje's Avatar
    Join Date
    Aug 2008
    Posts
    101
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    90.19 MB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    Hi Joesaliba,

    Thanks for replying. However I do notknow what a code snippet will add to this because it just an HPWM statment used. But, ofcourse, I made one. I will do almost anything while Irally need this new pc to work.

    I reduced my program to just 3 buttons (sorry, the variables are in dutch):
    1 to stop the motor
    2 to let the motor accelerate or run at max speed.
    3 to change the direction.

    Code:
    While 1 = 1
      If Knop1 = INGEDRUKT Then
                     DaalStijg = Daal
                     HPWM 2, 0, 0
                     AcceleratieTeller = 0
                     DalenStijgen = 0
     End If
      Inc AcceleratieTeller
     If Knop2 = INGEDRUKT Then
        If AcceleratieTeller < AcceleratieTellerMax Then
                     Dwordtemp =       snelheidArmOmhoog*AcceleratieTeller
                     Dwordtemp = Dwordtemp / AcceleratieTellerMax
                     HPWM 2, 127, Dwordtemp
         Else
                    HPWM 2, 127, snelheidArmOmhoog
         End If
     End If
      If Knop3 = INGEDRUKT Then
        Toggle DaalStijg
         While Knop3 = INGEDRUKT
             DelayMS 100
         Wend
     End If
     DelayMS 100
      Wend''Einde
    I have tested this code and also this code only runs when I compile it on my old PC..

    Please tell me if you want to see the header. Then I will reduce this to a minimum, test it and place it here..

  4. #4
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,062
    Thumbs Up
    Received: 38
    Given: 34
    Total Downloaded
    1.72 GB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    I'm not sure if this is the problem but, don't put End If, put Endif

    Charlie

  5. #5
    Member amateurtje's Avatar
    Join Date
    Aug 2008
    Posts
    101
    Thumbs Up
    Received: 0
    Given: 2
    Total Downloaded
    90.19 MB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    Hi Charlie,

    As expected, changing end if into endif did not help. Istill tested it to be 100% sure. As stated, the complete program works, even when I compile it with my new pc except the motor (hpwm statement). If the end if would be wrong, I think I would have a lot more problems..

  6. #6
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,327
    Thumbs Up
    Received: 51
    Given: 122
    Total Downloaded
    2.37 GB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    FWIW Les has said that either EndIf or End If are valid
    George

  7. #7
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,919
    Thumbs Up
    Received: 81
    Given: 25
    Total Downloaded
    1.37 GB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    I can't remember when but the syntax for declares changed some time back. It would be more helpful if you had a short complete program that we could test. Unfortunately I only have the free version of ISIS so can't set up a test but others may be able to.
    John
    Last edited by John Drew; 4th October 2017 at 00:51. Reason: Tablet automatically messed up a word

  8. #8
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    258
    Thumbs Up
    Received: 32
    Given: 0
    Total Downloaded
    76.31 MB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    Code:
    HPWM 2, 0, 0
    From what I can tell, no matter what channel number you put in the HPWM statement it always uses CCP1.
    That's with v3.6.0.3

  9. #9
    Developer Les's Avatar
    Join Date
    Feb 2002
    Posts
    3,230
    Thumbs Up
    Received: 234
    Given: 83
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    I've just doe some testing, and the HPWM command is working as expected with a 18F46K22 device.

    The simple demo below shows the test:

    Code:
        Device = 18F46K22
        Declare Xtal = 20
        
        Declare CCP1_Pin = PORTC.2      ' Choose the pin used by the CCP1 peripheral
        Declare CCP2_Pin = PORTC.1      ' Choose the pin used by the CCP2 peripheral
        
        HPWM 1, 127, 5000               ' Create a PWM signal from CCP1
        HPWM 2, 127, 5000               ' Create a PWM signal from CCP2
        
        Stop
    The signals on the oscilloscope show the correct outputs.

    However, for better control of the CCP peripherals for PWM, use the include I wrote a few years ago.

    Flexible Hpwm routines for 18F devices
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  10. #10
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    258
    Thumbs Up
    Received: 32
    Given: 0
    Total Downloaded
    76.31 MB

    1 Not allowed!

    Default Re: Problems on new PC (new version) with HPWM

    Sorry. My mistake!

    Code:
        Declare CCP1_Pin = PORTC.2      ' Choose the pin used by the CCP1 peripheral
        Declare CCP2_Pin = PORTC.1      ' Choose the pin used by the CCP2 peripheral
    I left out the CCP2 pin declare when I compiled that "HPWM 2, 0, 0", so it didn't produce code to setup CCP2.

    I wonder if the OP did the same...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. problems compiling old programs with latest version
    By C_Moore in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 17th May 2013, 22:34
  2. Problems installing latest version
    By orko_007 in forum Fuse Configurator
    Replies: 2
    Last Post: 1st July 2011, 19:24
  3. HPWM Device specific problems
    By David Snook in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 2nd June 2006, 08:30

Members who have read this thread since 4th November 2017, 10:11 : 2

Actions :  (Set Date)  (Clear Date)

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

Tags for this Thread

Posting Permissions

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