Leading 0's or BCD


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Jul 2005
    Posts
    93

    Exclamation Leading 0's or BCD

    let's say i have this command:

    SEROUT serpout, N9600, "A",#RRECADD,"B",#RBITVALUE,"C","227","D"]

    in which RRECADD and RBITVALUE are decimal byte variables which vary in length depending on if its like a 3 or a 255 in between the A - B etc.. ie. there are no leading 0's on the smaller values to "space out" the number of charecters in the string.


    The thing is i think my pc side and it's parsing routines would benefit (our parsing wouldnt fail as much due to incomplete "packets" or packets in which two A's appear in the same received string) if we could limit the input to a fixed number of bytes to receive (which we can do using visual basics mscomm control using the OnComm / comEvReceive events and setting the MSComm1.InputLen to whatever our complete data packet is going to be) then our data to parse would be what we sent and (hopefully) no more or less. The project is trying to implement a 2 way communication via PIC's, PC, and it uses TWS-434 and RWS-434 modules to do so at (eek only) N1200 (ok no so bad it's pretty reliable)

    The major problem is i cant count the length of my outgoing data string before i send it, i wanted to "fill" "packets" that were short charecters based on a subtracted total. But no length or LEN feature, so how to do this?

    I'm even considering converting to BCD (binary coded decimal) to transmit (does seem like much of a solution considering i would be - i think - increasing the amount of transmission for the same amount of actual data). But BCD values would give the desired fixed length

    I understand that this non byte array / buffer method of communication is "lossy" but i'm mostly interested in speed of data exchange (as close to real time as possible), data integrity is secondary, (its mostly reliable using this sort of "push" and "poll" method)
    Last edited by RYTECH; - 27th December 2005 at 02:06.

Similar Threads

  1. Bcd Fomat Help
    By Santana in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 28th November 2012, 06:00
  2. Can we suppress leading zero's in LCDOUT?
    By PICn-It in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 16th December 2009, 16:09
  3. DS1302 16F628 Woes
    By idtat in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th January 2009, 14:15
  4. Rotary BCD
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 03:04
  5. Real time clock... what a headache!
    By Eng4444 in forum mel PIC BASIC
    Replies: 2
    Last Post: - 8th June 2006, 21: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