Redirecting serial data at runtime


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Just had a quick look see at the library and it's immediately obvious that modifying the library to do what I suggested above will add a lot more code than just using HSEROUT2.
    I don't support you could post the source...maybe we could find a few places to save some code space for you. I'm up for it...

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Sorry, can't post the code (it is the property of the company I work for).

    But, you are probably correct in stating that the extra assy structures needed to switch between TX/RX REG1 and TX/RX REG2 would add too much code also.

    I'll have to look into this more.
    Charles Linquist

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I really appreciate the offer, though. I just saw where I can do some "compacting" myself.

    One part that takes up too much space - I have a complete SNMP agent running. I'll start there.
    Charles Linquist

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    I really appreciate the offer, though. I just saw where I can do some "compacting" myself.

    One part that takes up too much space - I have a complete SNMP agent running. I'll start there.
    One big thing I've found is with variables. You use a word when a byte will do. That right there uses up a lot of code space.

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I try to be careful. The program has over 6500 lines of PBP. There is some asm code involved, too.
    Charles Linquist

  6. #6
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    I try to be careful. The program has over 6500 lines of PBP. There is some asm code involved, too.
    Yikes!!! 6,500 lines of PBP code. I sure do not envy you. Good luck!

  7. #7
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Are you using DT's II

    Hi Charles,

    I don't know how you are processing the input string from one USART. Possibly you are using some form of interrupt. If you are using DT's instant interrupt and in PBP then there might be a way. I haven't gone through DT's routines so well that I know all about it. But it does allow the use ASM and PBP interrupt routines for a same source at the same time. So here is the idea.

    Keep a flag of yours which you set when a re-direction is necessary. Now say you have a PBP interrupt handler. Create another handler for the same Rx interrupt in ASM. If your flag is not set then just return from it by testing the bit. If set then execute your redirection code. Read the byte from one RCREG and put it to the other TXREG testing the hardware flags.

    Now clear the interrupt flags manually and any of DT's flag to make II believe that all has been done. This would possibly prevent the PBP handler in the second priority list to be invoked. You may need some tweaking though for example if

    DT's interrupt routine backs-up the PBP (reuse pbp) vars even when processing the ASM int. I am not sure about it. You need to go through them.

    Now you can tweak DT's routine to add a few defines for the port redirection.


    Since you are using a SNMP agent I believe it is some sort of round robbin multi tasking. So if you second USART is having its buffer full and busy TXing. And you cannot afford to block the code This all depends on the amount of traffic and if your application has scope. You may set-up small redirection ring buffer that gets triggered on successful transmission to find out if you have some more bytes left to be sent from the re-direction handler.
    Regards

    Sougata

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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