Redirecting serial data at runtime


Closed Thread
Results 1 to 21 of 21

Hybrid View

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

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

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

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

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

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


    Did you find this post helpful? Yes | No

    Default

    These are great ideas. I'm already processing HSERIN interrupts using both ASM and PBP (at different times).
    The project (as you would guess) is quite complicated. It does SNMP, telnet ,SSH and RS-232 protocols simultaneously. In some cases the RS-232 port must be connected directly to the telnet port of the network device (a Lantronix MatchPort AR) A whole lot of switching goes on in both hardware and firmware.

    It still amazes me that it all works at all. But I'm need a bit more functinality.

    Thanks.
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default You are welcome charles

    Hi,

    I tried C18 and C30 but couldn't even make out for the investment. PBP is comfortable cause it lets you use the resources in a native way and does not come in your own way. I am still a bit shaky with the 16F parts due to limited resources and lack of functionality. But I haven't found an occasion (or my projects were not complex enough) where an 18F couldn't do the job. Did I mention over-clocking ? Yes 16x4 HSPLL = 64 MHz.

    Writing 6500 lines is not what you plan when you start MCSP. It piles up and the best part is, it works as intended.

    One word of caution for newbies, comment your code well. I mean really well.

    It took me 2 days to figure out what I did 2 years back. So now-a-days I write comments like this:

    '/ Always comment your code well '/ This is a comment only
    Last edited by sougata; - 22nd September 2008 at 15:51. Reason: Spelling Mistake
    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