Reading large data via RS232


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44

    Default Reading large data via RS232

    Now i have stuck with processing in RS232. I want to send a large string about 2kB. The string starts with $FF and ends with $FF and between is my data.
    I tried with hserin and hserin2 [wait($FF), STR B0\96), but after this hserin stops. Itīs waiting for another $FF input.
    The array to reserve is max limits to 96Bytes "B0 VAR BYTE(96)". How to code something like this for 2kB of data ?

    thx Rob

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Cool

    Maybe it's better to use HSEROUT for sending data instead of HSERIN ;-)

    What do you realy want to build ?
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    I will send from PC (via SerialCom) a huge packet of data, beginning with $FF and ending with $FF.
    The PIC should receive the packet and store it to the FRAM.
    I tried it like above, but i receive max 96 Bytes and then waiting for another $FF. I just need to say to the PIC, when $FF is incoming, then read the data and store till another $FF instruction is following.

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


    Did you find this post helpful? Yes | No

    Default

    Have you looked at this http://www.picbasic.co.uk/forum/showthread.php?t=6982

    Bruce posted it yesterday, can not wait to try it myself.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2007
    Location
    Bavaria
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hi Rob,

    if you want your program to reiceve the 2k of characters and then store them to the FRAM, you would have to buffer them in the RAM.
    Which PIC are you using currently?

    Regards,

    Ingo

  6. #6
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Cool

    If you want to receive 2k Data inside two start-stop-signs, you can't use one PBP-command, you have to write a programm !

    like this:
    Repeat
    Read 1 character
    Until this is the start-character

    ende=0

    repeat
    Read 1 character
    if "this is the end"? then
    ende=1
    else
    store the character
    endif
    until ende=1

    And don't forget to use the hardware-UART !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  7. #7
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    I have an USART MAX232. Itīs on my dev. board included.
    I know how you mean to realize that, but i have to trigger the RX Channel with the incoming data from the computer? I use 9600Baud = 960 Bytes included start & stopbit.
    I think without serin commands can it be difficult to catch the bytes for the right time, maybe the input will shift for many bits!

  8. #8
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Cool

    Quote Originally Posted by Robson View Post
    I have an USART MAX232. Itīs on my dev. board included.
    No !
    The MAX232 isn't a USART. The USART is a part of the PIC. Just look, if the Rx- and Tx-Pins are propperly used.

    Quote Originally Posted by Robson View Post
    I know how you mean to realize that, but i have to trigger the RX Channel with the incoming data from the computer?
    No,
    after activating the USART, it will receive any character.

    Quote Originally Posted by Robson View Post
    I use 9600Baud = 960 Bytes included start & stopbit.
    Yes,
    every second !

    Quote Originally Posted by Robson View Post
    I think without serin commands can it be difficult to catch the bytes for the right time, maybe the input will shift for many bits!
    Without using HSERIN it will be impossible !
    You have 1/960 seconds to store a character.
    Writing to a EEPROM needs 10ms (10 times more) to complete the write-cycle.

    You have to store the data in RAM.

    If you are good - you can write 1 page (maybe 128 Bytes) to a serial eeprom and start the write-cycle and maybe 15 characters later you can start to submit the next page, so you must only buffer 15-30 characters.

    Using hardware-USART with interrupts will be much better.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  9. #9
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    I prefer to use FRAMīs. Then there will no troubles about writing to eeprom.

Similar Threads

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

Members who have read this thread : 1

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