(Picbasic Pro Compiler) Distinct management of two servos per timer(s) of 12F675?


Results 1 to 13 of 13

Threaded View

  1. #4
    Join Date
    Oct 2011
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: (Picbasic Pro Compiler) Distinct management of two servos per timer(s) of 12F675?

    I would do it like this. Change PULSE_PIN for the second channel
    Code not tested but should give some idea how to use timer 1

    Code:
    PIE.0 = 1   'Enable timer 1 overflow flag
    T1CON = 0   'Timer 1 stopped, internal clock
    PULSE_OUT VAR WORD
    
    START:
    PULSE_OUT = 1500               'Servo center value
    PULSE_OUT = $FFFF - PULSE_OUT  'Timer 1 counts upwards
    TMR1H = PULSE_OUT.HIGHBYTE
    TMR1L = PULSE_OUT.LOWBYTE  'Set timer 1
    PULSE_PIN_1 = 1  'Start pulse
    T1CON.0 = 1    'Start timer 1
    WHILE PIE1.0 = 0 : WEND   'Wait for Timer 1 overflow
    PULSE_PIN_1 = 0    'End pulse
    T1CON.0 = 0      'Stop timer 1
    PIE1.0 = 0       'Reset overflow flag
       'wait 20ms .............................
    GOTO START
    Last edited by Ioannis; - 28th May 2023 at 20:31.

Similar Threads

  1. Replies: 2
    Last Post: - 28th May 2016, 15:09
  2. Experimenting with the PicBasic Pro Compiler
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 17th May 2016, 20:17
  3. PicBasic Pro Compiler manual updated with bookmarks
    By mtripoli in forum Documentation
    Replies: 1
    Last Post: - 8th March 2011, 01:49
  4. Picbasic Pro compiler 2.60 error
    By Luckyborg in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd January 2010, 06:55
  5. PicBasic Pro Compiler for 877A
    By iwill920ya in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 31st May 2004, 05:10

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