Skip incoming bytes in SERIN


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Hi Mackrackit,

    Thank you.

    It is PIC16HV540.

    it has only 512 words of program memory, 25 bytes or RAM (enough for only three variables) and nothing else. BUT it is 15 volt chip including full 8 bit 15 volt port B (actually I use only two lines of them)

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Alexey View Post
    It is PIC16HV540.

    it has only 512 words of program memory, 25 bytes or RAM (enough for only three variables) and nothing else. BUT it is 15 volt chip including full 8 bit 15 volt port B (actually I use only two lines of them)
    Oh....
    I will need to think about that one...
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    This is interesting. I have never used a chip this "small"....

    What does the data stream look like and what part do you want to skip? Then what do you want to do with it?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    it is a repeating string and the bytes I need are located 9 bytes after symbol 85. Ideally there are 7 bytes I want to know but I have room only for three variables, so I may have to read them one by one every next sycle or use only the first one as it is most important and I only need to ignite a warning LED at certain read value. Now I do it this way:
    SERIN PORTB.3,T2400,4000,CLR,[85],VAR,VAR,VAR,VAR,VAR,VAR,VAR,VAR,VAR,VAR

    Skipping 9 bytes cost me 45 words of memory which is near 9% of what I have totally

    Yes, this chip is very small, but I could not find another one with at least one 15 volt port (regular or open drain) to read and write serial data directly

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Well I am stuck...
    Why not use another chip and a MAX232? Then the data could be pulled into an array.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Alexey View Post
    SERIN PORTB.3,T2400,4000,CLR,[85],VAR,VAR,VAR,VAR,VAR,VAR,VAR,VAR,VAR,VAR

    Skipping 9 bytes cost me 45 words of memory which is near 9% of what I have totally
    Hi Alexey,

    This program compiles to 124 words with a 16HV540.
    Code:
    INCLUDE "modedefs.bas"
    
    RX   VAR PORTB.3
    B0   VAR BYTE
    
    SERIN RX, T2400,[85]
    This one is 154 words.
    Code:
    INCLUDE "modedefs.bas"
    
    RX   VAR PORTB.3
    B0   VAR BYTE
    
    SERIN RX, T2400,[85],B0,B0,B0,B0,B0,B0,B0,B0,B0,B0
    But this one using DEBUGIN is only 75 words.
    Code:
    DEFINE DEBUGIN_REG PORTB ' Debugin pin port 
    DEFINE DEBUGIN_BIT 3     ' Debugin pin bit 
    DEFINE DEBUGIN_MODE 0    ' Debugin mode: 0 = True, 1 = Inverted 
    DEFINE DEBUG_BAUD 2400   ' Debug baud rate 
    
    B0      VAR BYTE
    MyData  VAR BYTE
    
    DEBUGIN [WAIT(85)]       ' wait for 85
    FOR B0 = 1 TO 9
        DEBUGIN [MyDATA]     ' skip 9 bytes
    NEXT B0
    DEBUGIN [MyDATA]         ' get the desired byte
    IF only I had a 16HV540 to test it on.
    DT

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Thanks again Darrel,
    I never even thought to try DEBUGIN and I certainly did not realize how compact it is.
    Another entry in the note book.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    For the longest time I completely ignored the DEBUG/DEBUGIN statements because it just seemed too much like a Basic Stamp command.

    Then I saw Bruce using them a lot and took another look.

    They really are better than SERIN/OUT, SERIN2/OUT2.
    As long as you only need one baud rate and fixed pins ... which fits probably 90% of the usual serial programs.

    Smaller, faster ... better.
    DT

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