+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Pic25k20 PWM Amicus board incorrect freq

  1. #1
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950

    Default Pic25k20 PWM Amicus board incorrect freq

    Hi

    I'm having loads of trouble with my the 25K20 setting up the PWM.

    I have a IR remote receiver and never have trouble getting a 38kh pwm going to drive an IR led.

    But the 25K20 is impossible.

    Hi, its great to see you visiting our forum. Why not try Proton Compiler for FREE?

    Download the FREE version of Proton Compiler, Its called Amicus18 and its available from HERE

    Already using proton Compiler??? Get rid of these pesky messages... get LICENSED USER STATUS




    I have tried it running at 64mhz as it is by default on the Amicus board using pwm settings from a web site I have used in the past. But no action. So Looked at what is produced on in ISIS to a signal input set at 38khz and its way out.
    Changed it to 16mhz by reprogramming and still wrong

    Double checked ISIS by using at 12f683 and some code I had. It was the same as the pulse generator. So I know ISIS is working ok.

    Basically I have tried every thing including the HPWM Command and nothing.

    HELP!! Any ideas?
    Tim


  2. If you're a Licensed user of PROTON DEVELOPMENT SUITE, apply for Licensed User Status to remove these pesky messages
     and get access to additional forum areas, Beta test downloads and more!

  3. #2
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Hi Tim
    It would help if you posted at least the configuration you are using to setup the appropriate registers to set your PWM value.
    Also, have you looked at the ouput on actual hardware on a scope ? - if so what were the results ?
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  4. #3
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    This is the code I used

    Its the same pwm set up as I have used on a 18f4520

    Code:
    ;-------------------------------------------------------------------------------;**** Added by Fuse Configurator ****
    ; Use the Fuse Configurator plug-in to change these settings
    
    
    	Device = 18F25K20
    
    
    	Declare Reminders Off
    	@ CONFIG_REQ = 0 ; Override Compiler's configuration settings
    	Asm-
    	Config FOSC = HS	;HS oscillator
    	Config FCMEN = OFF	;Fail-Safe Clock Monitor disabled
    	Config IESO = OFF	;Oscillator Switchover mode disabled
    	Config PWRT = On	;PWRT enabled
    	Config BOREN = OFF	;Brown-out Reset disabled in hardware and software
    	Config BORV = 22	;VBOR set to 2.2 V nominal
    	Config WDTEN = OFF	;WDT is controlled by SWDTEN bit of the WDTCON register
    	Config WDTPS = 1	;1:1
    	Config CCP2MX = PORTBE	;CCP2 input/output is multiplexed with RB3
    	Config PBADEN = OFF	;PORTB<4:0> pins are configured as digital I/O on Reset
    	Config LPT1OSC = OFF	;Timer1 configured for higher power operation
    	Config HFOFST = OFF	;The system clock is held off until the HFINTOSC is stable.
    	Config MCLRE = OFF	;RE3 input pin enabled; MCLR disabled
    	Config STVREN = OFF	;Stack full/underflow will not cause Reset
    	Config LVP = OFF	;Single-Supply ICSP disabled
    	Config XINST = On	;Instruction set extension and Indexed Addressing mode enabled
    	Config Debug = OFF	;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
    	Config CP0 = On	;Block 0 (000800-001FFFh) code-protected
    	Config CP1 = On	;Block 1 (002000-003FFFh) code-protected
    	Config CP2 = OFF	;Block 2 (004000-005FFFh) not code-protected
    	Config CP3 = On	;Block 3 (006000-007FFFh) code-protected
    	Config CPB = OFF	;Boot block (000000-0007FFh) not code-protected
    	Config CPD = OFF	;Data EEPROM not code-protected
    	Config WRT0 = OFF	;Block 0 (000800-001FFFh) not write-protected
    	Config WRT1 = OFF	;Block 1 (002000-003FFFh) not write-protected
    	Config WRT2 = OFF	;Block 2 (004000-005FFFh) not write-protected
    	Config WRT3 = OFF	;Block 3 (006000-007FFFh) not write-protected
    	Config WRTC = OFF	;Configuration registers (300000-3000FFh) not write-protected
    	Config WRTB = OFF	;Boot Block (000000-0007FFh) not write-protected
    	Config WRTD = OFF	;Data EEPROM not write-protected
    	Config EBTR0 = OFF	;Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
    	Config EBTR1 = OFF	;Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
    	Config EBTR2 = OFF	;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
    	Config EBTR3 = OFF	;Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
    	Config EBTRB = OFF	;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    	Endasm-
    
    
    	Declare Reminders On
    
    
    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
    
    
    
    
        Xtal 4
       
        
        Declare Create_Coff = On
    
    
    '    T2CON = 0b00000100; // prescaler + turn on TMR2;
    '    PR2 = 104;
    '    CCPR1L = 0b00110100;  // set duty MSB
    '    CCP1CON = 210; // duty lowest bits + PWM mode
    
    
        PR2 = 25                                    ' Set PWM Period for approximately 38KHz
        CCPR1L = 13      		                    ' Set PWM Duty-Cycle to 50% 
        CCP1CON = %00001100                         ' Mode select = PWM
        T2CON = %00000100		                    ' Timer2 ON + 1:1 prescale ratio
        
            
     ;   HPWM 1, 127, 38000
            
        Output PORTC.2
        
        While 1 = 1
       
        Wend
    Here is a capture of the scope from isis for various CPUs running and a ref pulse from a pulse generator
    The next snap is with a 18f4520 replacing the 18f25k20 as you can see all except the 25k20 look fine

    I have an old tube scope and a pico scope. I'm working up at the house as the office is to cold and has to much junk in it, so no room for the big scope and the pico is temperamental.

    All I want is a 38khz signal to try something out. I would have to go out and by a parts to build a new board and as its the week end I will not get them. The client is waiting and I cannot say I have to wait for Tuesday for parts.

    I thought the Amicus would be fine but the pic used has issues
    Attached Images Attached Images
    Tim

  5. #4
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Hi Tim
    should you not be using CCP2CON ? for standard (ie non enhanced) for standard PWM ?
    At first glance CCP1CON sets enhanced mode.

    See section 11.0 of datasheet ?

    otherwise your calcuations look fine - I get a freq of 38.46 Khz... (on the spreadsheet I did)
    I can send you a PWM calc spreadsheet if you like ?

    Joe.
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  6. #5
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Hi Joe

    That might be the problem.

    Yes please to the spreed sheet

    BTW I have found a remote control kit that has pic's in sockets in stock locally so will pick one up shortly

    http://www.maplin.co.uk/infrared-2-c...ler-kit-220034
    Last edited by Tim; 4th February 2012 at 11:52.
    Tim

  7. #6
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Hi Tim
    Here is the spreadsheet -
    It as rough as a bear's arse lol - but does the main job.
    Hope it helps -

    (Did you really write that - or were you testing the device ?? )
    Just ribbing ya dude !

    Hope ya get it sorted mate, otherwise, send me the DSN (I have a legal Proteus FULL) and I will check it out.

    Joe.
    Attached Files Attached Files
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  8. #7
    Licensed User pic-ignorant's Avatar
    Join Date
    Oct 2007
    Location
    Sunny Kent
    Posts
    2,125


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Off the top of my head, the ECCP should be fine to use if you set PSTRxCON = %00000001 to output the PWM pulse to P1A (CCP1 pin).

  9. #8
    Licensed User captainslarty's Avatar
    Join Date
    Sep 2006
    Location
    A Marina in Portugal
    Posts
    3,064


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Quote Originally Posted by pic-ignorant View Post
    Off the top of my head, the ECCP should be fine to use if you set PSTRxCON = 000001 to output the PWM pulse to P1A (CCP1 pin).
    Hi John
    thats a good point - it also reminds me that I never did do those pulse steering experiments - you just re-fired my interest in that one
    Joe
    Civilisation is the limitless mutiplication of unecessary necessities ... (Mark Twain)

  10. #9
    Licensed User pic-ignorant's Avatar
    Join Date
    Oct 2007
    Location
    Sunny Kent
    Posts
    2,125


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    Did you sort this out Tim?

  11. #10
    Licensed User Tim's Avatar
    Join Date
    Jan 2003
    Location
    london
    Posts
    6,950


    Default Re: Pic25k20 PWM Amicus board incorrect freq

    No, its a sorry tale of wasted time.

    I purchased a IR kit to save time. Thought, well at least I will have as starting point. They used a 12f629, in the Sender one the RX side. It turns out they came un-programmed. SO I wrote a small bit of code to do the 36khz I wanted. No luck at all. The signal was there at the right freq. Matched it to my TV's Remote that made the IR receiver chip I had work.

    It turned out after checking the packing on the IR diode in the kit that it was not an IR diode after all. It was a IR transistor receiver! Replaced it with an IR diode I had and it started working. SO they sold a kit with non programmed parts and with the wrong parts.

    In the end now I can do the job with a 10F200, for now though, its all software in a 12f629.
    Tim

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 8
    Last Post: 15th November 2011, 18:54
  2. HPWM frequency incorrect?
    By hadv215 in forum Proton Plus Compiler v3
    Replies: 14
    Last Post: 22nd February 2011, 16:57
  3. Incorrect calculation in VSM
    By Sparky1039 in forum Labcenter Proteus VSM
    Replies: 8
    Last Post: 25th May 2008, 19:45
  4. freq counter idea
    By digitalis in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 7th October 2007, 09:44
  5. Possible incorrect USB Key
    By joesaliba in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 23rd June 2006, 16:25

Members who have read this thread since 16th March 2012, 11:57 : 3

Actions :  (Set Date)  (Clear Date)

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