PBP3 Timer and RS232


Results 1 to 4 of 4

Threaded View

  1. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: PBP3 Timer and RS232

    OK ...

    I dug out the original Query ...

    the goal is to output a pulse whose length is given by the RS232 message received ...

    Here is the trail code ( excerpt ! )...
    Code:
    DEFINE OSC 16 'Oscillator speed in MHz: 3(3.58) 4 8 10 12 16 20 24 25 32 33 40 
    tmr1GE var  t1gcon.7
    TMR1ON  var  T1CON.0
    TMR1IF  VAR  PIR1.0       ' Alias RCIF (USART Receive Interrupt Flag)
    LED1  VAR  PORTC.1      ' Alias LED 
    LED2  VAR  PORTC.2      ' Alias LED 
    
    IN_SBUS var PORTC.5    'p 5
    S1  VAR  PORTA.5      ' p 2
    i   VAR  BYTE  ' loop counter 
    
    ' voir fichier "PIC16F1825.INFO"
    'Config pour PIC16F1825
    '*************************************************  *****************************
    'Configuration
    '*************************************************  *****************************
      #CONFIG
        __config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF  & _CLKOUTEN_OFF
        __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
      #ENDCONFIG
    
    on interrupt goto timer_int
    disable
      osccon=%01111011    'page 70
      ansela=0    'page 126
      anselc=0
      option_reg=0   'page 185   bit7 à zéro pour pouvoir activer les résistances de pull up
      apfcon0=0   'page 121
      apfcon1=0   'page 122
      wpuc=%00100000  'page 137  pull up sur C5
       trisa=%11011111
       trisc=%11111001    
    
    recom_test:
    gosub essai_timer
    gosub test_led
    led1=0
    debut:
    led2=!led2
    for i=1 to 100      'si je met "pause 100", la led régie par le timer clignote mais pas à la cadence du timer
        pause 1
        next i
    goto debut
    
    
    test_led:   ' teste les leds au début juste pour voir si le programme démarre
    for i=1 to 10
    led1=0
    pause 50
    led2=0
    pause 50
    led1=1
    pause 50
    led2=1
    pause 50
    next i
    return
    
    disable
    timer_int:
    'TMR1ON=0
    led1=!led1
    tmr1h=200
    tmr1l=200
    'TMR1ON=1
    T1con=%00000101     'page 195
    'tmr1GE=1
    tmr1if=0
    resume
    enable
    
    essai_timer:
    ''pour timer1 :
    T1con=%00000100     'page 195
    tmr1h=128
    tmr1l=128 
    intcon=%11000000    'page 90
    pie1  =%00000001    'page 91
    pie3  =0
    tmr1if=0
    T1con=%00000101     'page 195 lancer une première fois le timer
    'tmr1GE=1
    return
    
    End
    OKayyyyyyyyyyyyyyy

    I finally understood !!!

    It's a trail to tweak the FUTABA ( R/C systems ) SBus protocol ...

    output pulse is a classical servo signal ( 1.5ms +/- 500µs @ 50 Hz ) ...

    so, final goal is to convert a RS232 info into a corresponding R/C pulse .... or to be exact ... convert an RS232 stream ( 4 servo positions ? ) into ... multiple R/C pulses ( 4 ? )

    I wonder this kind of matter has already been treated here or aboard RC Groups forum ...


    Alain ( who has no interest in that except ... friendship ! )
    Last edited by Acetronics2; - 17th February 2014 at 08:41.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. PBP3 and MCSP
    By Luckyborg in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th March 2012, 15:44
  2. I really need some help with PBP3
    By Ramius in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th February 2012, 16:05
  3. PBP3 and MPLAB 8.83
    By grahamg in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 10th February 2012, 13:04
  4. Pbp3
    By rcbandwidth in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 18th September 2011, 14:13
  5. What's with PBP3?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th August 2011, 17:09

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