Is it possible to interpret non-standard serial data with PicBasic (sample attached)


Closed Thread
Results 1 to 40 of 61

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,154


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    Yes is goes up that way, I can record it up to 9, but you are correct, it looks like plain BCD code, but the rendering of "0" and "1" with pulses, looks weird for me. I have saelae logic analyzer, but it can't detect these pulses at all, I've used scope to record them.

    In fact, I want very simple thing - say, set variable ENABLE=0, when "zero" is transmitted, and ENABLE=1, when any other digit is being sent. I'm not looking for character decoding or whatsoever.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,154


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    I was suggested, that this is PPM (Pulse Position Modulation), used in some IR/RF remotes and telemetric control equipment. Datasheet of Holtek HT6222 shows quite similar, but not exact diagram of signal.

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    If you need only ENABLE use count to count pulses.
    Try something like this:

    Code:
    COUNT Pin, Period, Var
    If Var<xxx then
        enable=1
    else 
        enable=0
    endif

  4. #4
    Join Date
    Feb 2013
    Posts
    1,154


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    But pulses are of different width in series, will it work?

  5. #5
    Join Date
    Feb 2013
    Posts
    1,154


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    Just checked, it works, but not as it should - even on same sequence, it always reads different values.

    Code:
    taki:
    COUNT PORTC.4, 70, LABEL
    if label=0 then
    goto taki
    endif
    LCDOUT $FE,$c0, DEC(LABEL), "          "
    PAUSE 5
    GOTO TAKI

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    try this:
    taki:
    While PORTC.4=0
    WEND
    COUNT PORTC.4, 70, LABEL
    LCDOUT $FE,$c0, DEC5 LABEL
    PAUSE 5
    GOTO TAKI

  7. #7
    Join Date
    Feb 2013
    Posts
    1,154


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    The actual issue is different I guess.

    The system used is IDPPM - Differential Pulse Position Modulation.
    Now I changed algorithm, and it detects pulses, there are 34 pulses, and it does it properly. But quantity of pulses is always 34, only pauses between them change, so COUNT is not proper implementation I guess.

    P.S. above code displays only 00000

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,689


    Did you find this post helpful? Yes | No

    Default Re: Is it possible to interpret non-standard serial data with PicBasic (sample attach

    well the dsp module is interesting but for this project perhaps its easier to do it the old way


    Code:
    '****************************************************************
    '*  Name    : MODULATOR.BAS                                     *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2016 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 5/29/2016                                         *
    '*  Version : 1.0                                               *
    '*  Notes   :                        *
    '*          : 16F1825                                           *
    '****************************************************************
      #CONFIG
                 __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF            
    #ENDCONFIG
     
    OSCCON=$70
    DEFINE OSC 32
    
    
    
    '                       PIC 16F1825
    
    
    
    TRISA     = %001111	   ' Make some pins Input 
    trisc     = %001111  ;Make some pins Input   
    ANSELA=0     
    ANSELC=0
    
    
    
    X VAR byte
    darta   VAR byte[4] 
    
    
        clear
        
        modout var latc.4
        darta.0[14]=1 
        darta.0[15]=1 
    
       
        modout =1
        lata.5=0    ;cro triger
    Main_Loop:
        lata.5=1
        modout=0
        pauseus 9900
        modout =1
        pauseus 1880
        for x = 0 to 30 
            modout =0
            if  darta.0[x]  then    
                pauseus 2000
            else
                pauseus 780 
            endif
            modout =1
            pauseus  635 
        next
        modout =1
        lata.5=0
        PAUSE 200 
    
    goto Main_Loop
    end
    Warning I'm not a teacher

Similar Threads

  1. Is there an ICSP pinout standard???
    By OldMarty in forum General
    Replies: 12
    Last Post: - 21st September 2016, 13:29
  2. Interpret to Picbasic Code ¿?!!
    By Denner in forum PBP3
    Replies: 3
    Last Post: - 9th June 2015, 19:00
  3. sample code for AT45DB642D in Picbasic Pro
    By itsssyam in forum General
    Replies: 0
    Last Post: - 10th March 2010, 07:01
  4. Max/232 Bootloader problems - Schematic attached...
    By rossfree in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 4th May 2007, 16:54
  5. Replies: 0
    Last Post: - 30th November 2004, 03:18

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