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
    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

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


    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?

  3. #3
    Join Date
    Feb 2013
    Posts
    1,132


    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

  4. #4
    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

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


    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

  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

    I was thinking that 1 is represented with missing pulse.
    You can try something like this
    Code:
    DEFINE PULSIN_MAX 65535 ' Limit wait-for-pulse and maximum-pulse count
    While PORTC.4=0 'wait for rising edge of start pulse
    WEND
    FOR I=0 TO 33
    PULSIN PORTC.4,0,W3
    IF W3>XXX THEN GOTO GotData
    NEXT I

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


    Did you find this post helpful? Yes | No

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

    A side note, a statement like

    IF PORTC.4=1 THEN

    actually sets PORTC.4 high.

    Is this bug or feature?

    I've added 1 transistor signal inverter, but no help. Also, your code does not work.

    OK, I will give up with this idea.

Similar Threads

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